[SCM] Google Gadgets packaging branch, master, updated. debian/0.11.2-4-4-g298f18d
Pino Toscano
pino at alioth.debian.org
Tue Sep 6 17:13:05 UTC 2011
The following commit has been merged in the master branch:
commit e1331a0913db06685ff825080b3791d81f9c48a8
Author: Pino Toscano <pino at debian.org>
Date: Tue Sep 6 18:59:22 2011 +0200
add patches nm09.patch and nm-mobile-devtypes.patch for nm 0.9 (#640392)
---
debian/changelog | 3 +
debian/patches/nm-mobile-devtypes.patch | 38 ++++++
debian/patches/nm09.patch | 204 +++++++++++++++++++++++++++++++
debian/patches/series | 2 +
4 files changed, 247 insertions(+), 0 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index e8b9fe4..4f3febc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
google-gadgets (0.11.2-5) unstable; urgency=low
* Change libltdl3-dev build-dependency to libltdl-dev.
+ * Add patches nm09.patch and nm-mobile-devtypes.patch from the upstream
+ bug tracker, to fix (and improve) compatibility with Network Manager
+ 0.9. (Closes: #640392)
-- Pino Toscano <pino at debian.org> Tue, 06 Sep 2011 17:52:07 +0200
diff --git a/debian/patches/nm-mobile-devtypes.patch b/debian/patches/nm-mobile-devtypes.patch
new file mode 100644
index 0000000..36ea7ae
--- /dev/null
+++ b/debian/patches/nm-mobile-devtypes.patch
@@ -0,0 +1,38 @@
+Description: update for additional NM device types
+ This patch adds support for mobile broadband device types.
+ It should be backwards compatible with 0.6, 0.7, and 0.8 as well as using
+ the new device types in 0.9.
+Author: danielcbwilliams at gmail.com
+Bug: http://code.google.com/p/google-gadgets-for-linux/issues/detail?id=378
+
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.devtypes google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.devtypes 2011-03-25 11:04:20.697374611 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc 2011-03-25 11:08:01.732611291 -0500
+@@ -26,6 +26,11 @@ namespace linux_system {
+ static const int kDeviceTypeUnknown = 0;
+ static const int kDeviceTypeEthernet = 1;
+ static const int kDeviceTypeWifi = 2;
++static const int kDeviceTypeOldGsm = 3;
++static const int kDeviceTypeOldCdma = 4;
++static const int kDeviceTypeBluetooth = 5;
++static const int kDeviceTypeWimax = 7;
++static const int kDeviceTypeModem = 8;
+
+ // 0.6, 0.7, and 0.8 connected state
+ static const int kOldConnected = 3;
+@@ -171,6 +176,15 @@ void Network::Update() {
+ } else if (type == kDeviceTypeWifi) {
+ connection_type_ = CONNECTION_TYPE_NATIVE_802_11;
+ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_NATIVE_802_11;
++ } else if (type == kDeviceTypeBluetooth) {
++ connection_type_ = CONNECTION_TYPE_WIRELESS_WAN;
++ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_BLUETOOTH;
++ } else if (type == kDeviceTypeModem ||
++ type == kDeviceTypeOldGsm ||
++ type == kDeviceTypeOldCdma ||
++ type == kDeviceTypeWimax) {
++ connection_type_ = CONNECTION_TYPE_WIRELESS_WAN;
++ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_WIRELESS_WAN;
+ } else {
+ connection_type_ = CONNECTION_TYPE_UNKNOWN;
+ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_UNSPECIFIED;
diff --git a/debian/patches/nm09.patch b/debian/patches/nm09.patch
new file mode 100644
index 0000000..45b3a27
--- /dev/null
+++ b/debian/patches/nm09.patch
@@ -0,0 +1,204 @@
+Description: Update for NetworkManager 0.9 API changes
+ This patch updates the code for a few NM 0.9 API changes.
+ It builds, but I have not extensively tested the functionality.
+ NM 0.9 has added a few new connection and device states, and renumbered the
+ existing ones.
+ This means it's possible to keep compatibility with both old and new versions
+ of NM since the state numbers don't conflict.
+ The patch does this by removing some usage of defines from NetworkManager.h.
+ .
+ Furthermore, the device enums aren't going to get renumbered so I added them
+ to the code instead of using the defines. They've been the same since the
+ beginning.
+Author: danielcbwilliams at gmail.com
+Bug: http://code.google.com/p/google-gadgets-for-linux/issues/detail?id=377
+
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.nm09 2009-03-14 23:12:42.000000000 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc 2011-03-25 10:58:29.022771149 -0500
+@@ -23,19 +23,21 @@ namespace ggadget {
+ namespace framework {
+ namespace linux_system {
+
+-#ifdef NM_DEVICE_TYPE_WIFI
+-static const int kDeviceTypeWifi = NM_DEVICE_TYPE_WIFI;
+-#else
+-static const int kDeviceTypeWifi = DEVICE_TYPE_802_11_WIRELESS;
+-#endif
+-
+-#ifdef NM_DEVICE_TYPE_ETHERNET
+-static const int kDeviceTypeEthernet = NM_DEVICE_TYPE_ETHERNET;
+-#else
+-static const int kDeviceTypeEthernet = DEVICE_TYPE_802_3_ETHERNET;
+-#endif
+-
+ static const int kDeviceTypeUnknown = 0;
++static const int kDeviceTypeEthernet = 1;
++static const int kDeviceTypeWifi = 2;
++
++// 0.6, 0.7, and 0.8 connected state
++static const int kOldConnected = 3;
++// New 0.9 connected states
++static const int kConnectedLocal = 50;
++static const int kConnectedSite = 60;
++static const int kConnectedGlobal = 70;
++
++// 0.6, 0.7, and 0.8 activated device state
++static const int kOldDeviceStateActivated = 8;
++// New 0.9 activated device state
++static const int kDeviceStateActivated = 100;
+
+ Network::Network()
+ : is_new_api_(false),
+@@ -59,14 +61,14 @@ Network::Network()
+ is_new_api_ = true;
+ int state;
+ if (network_manager_->GetProperty("State").v().ConvertToInt(&state)) {
+- is_online_ = (state == NM_STATE_CONNECTED);
++ is_online_ = IsOnlineState(state);
+ }
+ } else {
+ DLOG("network manager 0.6.x might be used.");
+ DBusIntReceiver result;
+ if (network_manager_->CallMethod("state", true, kDefaultDBusTimeout,
+ result.NewSlot(), MESSAGE_TYPE_INVALID)) {
+- is_online_ = (result.GetValue() == NM_STATE_CONNECTED);
++ is_online_ = IsOnlineState(result.GetValue());
+ }
+ }
+
+@@ -87,14 +89,21 @@ Network::~Network() {
+ delete network_manager_;
+ }
+
++bool Network::IsOnlineState(int state) {
++ return (state == kOldConnected ||
++ state == kConnectedLocal ||
++ state == kConnectedSite ||
++ state == kConnectedGlobal);
++}
++
+ void Network::OnSignal(const std::string &name, int argc, const Variant *argv) {
+ DLOG("Got signal from network manager: %s", name.c_str());
+ bool need_update = false;
+- // nm 0.6.x uses "StateChange", 0.7.x uses "StateChanged".
++ // nm 0.6.x uses "StateChange", 0.7.x and later use "StateChanged".
+ if (name == "StateChange" || name == "StateChanged") {
+ int state;
+ if (argc >= 1 && argv[0].ConvertToInt(&state)) {
+- is_online_ = (state == NM_STATE_CONNECTED);
++ is_online_ = IsOnlineState(state);
+ DLOG("Network is %s.", is_online_ ? "connected" : "disconnected");
+ if (is_online_) {
+ need_update = true;
+@@ -133,7 +142,8 @@ void Network::Update() {
+ if (is_new_api_) {
+ int state;
+ if (dev->GetProperty("State").v().ConvertToInt(&state))
+- active = (state == 8); // NM_DEVICE_STATE_ACTIVATED
++ active = (state == kOldDeviceStateActivated ||
++ state == kDeviceStateActivated);
+ } else {
+ DBusBooleanReceiver result;
+ if (dev->CallMethod("getLinkActive", true, kDefaultDBusTimeout,
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h.nm09 2011-03-25 10:51:31.120995640 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h 2011-03-25 10:52:03.881586075 -0500
+@@ -55,6 +55,7 @@ class Network : public NetworkInterface
+ private:
+ void OnSignal(const std::string &name, int argc, const Variant *argv);
+ void Update();
++ bool IsOnlineState(int state);
+
+ private:
+ // true if using nm 0.7 or above, false if using nm 0.6.x
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc.nm09 2011-03-25 10:53:42.462353647 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc 2011-03-25 11:01:53.707212241 -0500
+@@ -28,11 +28,10 @@
+ #include <ggadget/string_utils.h>
+ #include <ggadget/slot.h>
+
+-// defined in <linux/wireless.h>, but we don't want to introduce such
+-// dependency.
+-#define IW_MODE_AUTO 0
+-#define IW_MODE_ADHOC 1
+-#define IW_MODE_INFRA 2
++// Define them anyway for all versions of NM
++static const int kNmWifiModeUnknown = 0;
++static const int kNmWifiModeAdhoc = 1;
++static const int kNmWifiModeInfra = 2;
+
+ #if !defined(NM_DBUS_SERVICE) || !defined(NM_DBUS_PATH) || \
+ !defined(NM_DBUS_INTERFACE)
+@@ -77,15 +76,15 @@ namespace linux_system {
+
+ using namespace ggadget::dbus;
+
+-#ifdef NM_DEVICE_TYPE_WIFI
+-static const int kDeviceTypeWifi = NM_DEVICE_TYPE_WIFI;
+-#else
+-static const int kDeviceTypeWifi = DEVICE_TYPE_802_11_WIRELESS;
+-#endif
++static const int kDeviceTypeWifi = 2;
+
+ // Defined in nm 0.7
+-static const int kDeviceStateActivated = 8;
+-static const int kDeviceStateFailed = 9;
++static const int kOldDeviceStateActivated = 8;
++static const int kOldDeviceStateFailed = 9;
++// New 0.9 activated device state
++static const int kDeviceStateActivated = 100;
++static const int kDeviceStateDeactivating = 110;
++static const int kDeviceStateFailed = 120;
+
+ class Wireless::Impl {
+ class WirelessAccessPoint : public WirelessAccessPointInterface {
+@@ -191,7 +190,7 @@ class Wireless::Impl {
+
+ void UpdateInfo() {
+ if (ap_) {
+- int mode = IW_MODE_AUTO;
++ int mode = kNmWifiModeUnknown;
+ if (new_api_) { // nm 0.7.x
+ ResultVariant prop = ap_->GetProperty("Ssid");
+ if (prop.v().type() == Variant::TYPE_SCRIPTABLE) {
+@@ -223,9 +222,9 @@ class Wireless::Impl {
+ }
+ }
+
+- if (mode == IW_MODE_ADHOC)
++ if (mode == kNmWifiModeAdhoc)
+ type_ = WIRELESS_TYPE_INDEPENDENT;
+- else if (mode == IW_MODE_INFRA)
++ else if (mode == kNmWifiModeInfra)
+ type_ = WIRELESS_TYPE_INFRASTRUCTURE;
+ else
+ type_ = WIRELESS_TYPE_ANY;
+@@ -404,9 +403,13 @@ class Wireless::Impl {
+ } else if (signal == "StateChanged") { // nm 0.7.x
+ int new_state;
+ if (argc >= 1 && argv[0].ConvertToInt(&new_state)) {
+- connected_ = (new_state == kDeviceStateActivated);
++ connected_ = (new_state == kDeviceStateActivated ||
++ new_state == kOldDeviceStateActivated);
+ connect_performed = (new_state == kDeviceStateActivated ||
+- new_state == kDeviceStateFailed);
++ new_state == kDeviceStateDeactivating ||
++ new_state == kDeviceStateFailed ||
++ new_state == kOldDeviceStateActivated ||
++ new_state == kOldDeviceStateFailed);
+ }
+ } else if (signal == "AccessPointAdded") { // nm 0.7.x
+ std::string ap_path;
+@@ -441,7 +444,9 @@ class Wireless::Impl {
+ if (new_api_ && dev_ && dev_wireless_) {
+ ResultVariant prop = dev_->GetProperty("State");
+ if (prop.v().type() == Variant::TYPE_INT64) {
+- connected_ = (VariantValue<int>()(prop.v()) == kDeviceStateActivated);
++ int state = VariantValue<int>()(prop.v());
++ connected_ = (state == kDeviceStateActivated ||
++ state == kOldDeviceStateActivated);
+ }
+ } else if (!new_api_ && dev_) {
+ DBusBooleanReceiver bool_receiver;
diff --git a/debian/patches/series b/debian/patches/series
index c03e55e..9186c43 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,5 @@
03_GRE_Version.patch
04_hurd.patch
05_hurd_pthread.patch
+nm09.patch
+nm-mobile-devtypes.patch
--
Google Gadgets packaging
More information about the pkg-kde-commits
mailing list