diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2016-06-30 20:26:57 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-05-31 23:31:18 +0200 |
commit | d31c50870d0bee042ce660e445c9294a59a3a65b (patch) | |
tree | 6bfc0de3c95267b401b620c2c67859557dc60f97 /source/a/upower | |
parent | 76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (diff) | |
download | current-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.gz |
Slackware 14.2slackware-14.2
Thu Jun 30 20:26:57 UTC 2016
Slackware 14.2 x86_64 stable is released!
The long development cycle (the Linux community has lately been living in
"interesting times", as they say) is finally behind us, and we're proud to
announce the release of Slackware 14.2. The new release brings many updates
and modern tools, has switched from udev to eudev (no systemd), and adds
well over a hundred new packages to the system. Thanks to the team, the
upstream developers, the dedicated Slackware community, and everyone else
who pitched in to help make this release a reality.
The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided
32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware
project by picking up a copy from store.slackware.com. We're taking
pre-orders now, and offer a discount if you sign up for a subscription.
Have fun! :-)
Diffstat (limited to 'source/a/upower')
9 files changed, 544 insertions, 5 deletions
diff --git a/source/a/upower/patches/Fix-HID-rules-header-as-per-discussions.patch b/source/a/upower/patches/Fix-HID-rules-header-as-per-discussions.patch new file mode 100644 index 00000000..d6100394 --- /dev/null +++ b/source/a/upower/patches/Fix-HID-rules-header-as-per-discussions.patch @@ -0,0 +1,36 @@ +From ae9f8521c6f900255df1b6c7bc9f6adfd09abda5 Mon Sep 17 00:00:00 2001 +From: Arnaud Quette <arnaud.quette@free.fr> +Date: Mon, 22 Jun 2015 15:11:15 +0200 +Subject: [PATCH 1/2] Fix HID rules header, as per discussions + +Signed-off-by: Richard Hughes <richard@hughsie.com> +--- + rules/95-upower-hid.rules | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/rules/95-upower-hid.rules b/rules/95-upower-hid.rules +index dcf4380..767e9bc 100644 +--- a/rules/95-upower-hid.rules ++++ b/rules/95-upower-hid.rules +@@ -1,10 +1,16 @@ + ############################################################################################################## + # Uninterruptible Power Supplies with USB HID interfaces + # +-# to keep up to date, monitor: http://svn.debian.org/wsvn/nut/trunk/scripts/upower/95-upower-hid.rules ++# This file was automatically generated by NUT: ++# https://github.com/networkupstools/nut/ ++# ++# To keep up to date, monitor upstream NUT ++# https://github.com/networkupstools/nut/commits/master/scripts/upower/95-upower-hid.rules ++# or checkout the NUT repository and call 'tools/nut-usbinfo.pl' + +-# only support USB, else ignore ++# newer hiddev are part of the usbmisc class + SUBSYSTEM=="usbmisc", GOTO="up_hid_chkdev" ++# only support USB, else ignore + SUBSYSTEM!="usb", GOTO="up_hid_end" + + # if usbraw device, ignore +-- +2.6.4 + diff --git a/source/a/upower/patches/Update-UPower-HID-rules-supported-devices-list.patch b/source/a/upower/patches/Update-UPower-HID-rules-supported-devices-list.patch new file mode 100644 index 00000000..8ef4498c --- /dev/null +++ b/source/a/upower/patches/Update-UPower-HID-rules-supported-devices-list.patch @@ -0,0 +1,114 @@ +From fc27cbd5cb098ccf6c70110fe1b894987328fc0d Mon Sep 17 00:00:00 2001 +From: Arnaud Quette <arnaud.quette@free.fr> +Date: Mon, 8 Jun 2015 10:08:24 +0200 +Subject: [PATCH 2/2] Update UPower HID rules - supported devices list + +As per update on the NUT - Network UPS Tools project, this first patch +adds some more supported devices to the rules file + +Signed-off-by: Richard Hughes <richard@hughsie.com> +--- + rules/95-upower-hid.rules | 31 +++++++++++++++++++++++++++++-- + 1 file changed, 29 insertions(+), 2 deletions(-) + +diff --git a/rules/95-upower-hid.rules b/rules/95-upower-hid.rules +index 767e9bc..e064ef7 100644 +--- a/rules/95-upower-hid.rules ++++ b/rules/95-upower-hid.rules +@@ -23,21 +23,31 @@ ENV{DEVTYPE}=="usb_interface", GOTO="up_hid_end" + ATTRS{idVendor}=="03f0", ENV{UPOWER_VENDOR}="Hewlett Packard" + ATTRS{idVendor}=="0463", ENV{UPOWER_VENDOR}="Eaton" + ATTRS{idVendor}=="047c", ENV{UPOWER_VENDOR}="Dell" ++ATTRS{idVendor}=="04d8", ENV{UPOWER_VENDOR}="Minibox" + ATTRS{idVendor}=="050d", ENV{UPOWER_VENDOR}="Belkin" + ATTRS{idVendor}=="051d", ENV{UPOWER_VENDOR}="APC" +-ATTRS{idVendor}=="06da", ENV{UPOWER_VENDOR}="Liebert" ++ATTRS{idVendor}=="0592", ENV{UPOWER_VENDOR}="Powerware" ++ATTRS{idVendor}=="06da", ENV{UPOWER_VENDOR}="Phoenixtec Power Co., Ltd" ++ATTRS{idVendor}=="075d", ENV{UPOWER_VENDOR}="iDowell" + ATTRS{idVendor}=="0764", ENV{UPOWER_VENDOR}="Cyber Power Systems" + ATTRS{idVendor}=="09ae", ENV{UPOWER_VENDOR}="TrippLite" + ATTRS{idVendor}=="0d9f", ENV{UPOWER_VENDOR}="PowerCOM" + ATTRS{idVendor}=="10af", ENV{UPOWER_VENDOR}="Liebert" + + # Hewlett Packard ++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f06", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f08", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f09", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f0a", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe0", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe1", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe2", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe3", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe5", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe6", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe7", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe8", ENV{UPOWER_BATTERY_TYPE}="ups" + + # Eaton + ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" +@@ -46,6 +56,10 @@ ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups + # Dell + ATTRS{idVendor}=="047c", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups" + ++# Minibox ++ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d004", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d005", ENV{UPOWER_BATTERY_TYPE}="ups" ++ + # Belkin + ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{UPOWER_BATTERY_TYPE}="ups" +@@ -55,15 +69,23 @@ ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0900", ENV{UPOWER_BATTERY_TYPE}="ups + ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0980", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0f51", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", ENV{UPOWER_BATTERY_TYPE}="ups" + + # APC ++ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0000", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0002", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0003", ENV{UPOWER_BATTERY_TYPE}="ups" + +-# Liebert ++# Powerware ++ATTRS{idVendor}=="0592", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups" ++ ++# Phoenixtec Power Co., Ltd + ATTRS{idVendor}=="06da", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups" + ++# iDowell ++ATTRS{idVendor}=="075d", ATTRS{idProduct}=="0300", ENV{UPOWER_BATTERY_TYPE}="ups" ++ + # Cyber Power Systems + ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0005", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0501", ENV{UPOWER_BATTERY_TYPE}="ups" +@@ -92,6 +114,7 @@ ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3012", ENV{UPOWER_BATTERY_TYPE}="ups + ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3013", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3014", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3015", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3016", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4001", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4002", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4003", ENV{UPOWER_BATTERY_TYPE}="ups" +@@ -102,6 +125,8 @@ ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4007", ENV{UPOWER_BATTERY_TYPE}="ups + ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4008", ENV{UPOWER_BATTERY_TYPE}="ups" + + # PowerCOM ++ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a2", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a3", ENV{UPOWER_BATTERY_TYPE}="ups" + ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a4", ENV{UPOWER_BATTERY_TYPE}="ups" +@@ -110,5 +135,7 @@ ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a6", ENV{UPOWER_BATTERY_TYPE}="ups + + # Liebert + ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups" ++ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0008", ENV{UPOWER_BATTERY_TYPE}="ups" + + LABEL="up_hid_end" +-- +2.6.4 + diff --git a/source/a/upower/patches/linux-Clamp-percentage-for-overfull-batteries.patch b/source/a/upower/patches/linux-Clamp-percentage-for-overfull-batteries.patch new file mode 100644 index 00000000..bb97ca78 --- /dev/null +++ b/source/a/upower/patches/linux-Clamp-percentage-for-overfull-batteries.patch @@ -0,0 +1,77 @@ +From b8fe9902f3c6c50ca6a23e24fcea99582beebc65 Mon Sep 17 00:00:00 2001 +From: Martin Pitt <martinpitt@gnome.org> +Date: Tue, 22 Oct 2013 10:02:51 +0200 +Subject: [PATCH 2/3] linux: Clamp percentage for overfull batteries + +Some batteries report energy > energy_full and a percentage ("capacity" +attribute) > 100%. Clamp these within 0 and 100% for both plausibility as well +as to avoid setting an out-of-range property which would then become 0%. + +https://launchpad.net/bugs/1240673 +--- + src/linux/integration-test | 33 +++++++++++++++++++++++++++++++++ + src/linux/up-device-supply.c | 4 ++++ + 2 files changed, 37 insertions(+) + +diff --git a/src/linux/integration-test b/src/linux/integration-test +index 8489bf3..4be1922 100755 +--- a/src/linux/integration-test ++++ b/src/linux/integration-test +@@ -442,6 +442,39 @@ class Tests(unittest.TestCase): + self.assertEqual(self.get_dbus_property('OnLowBattery'), False) + self.stop_daemon() + ++ def test_battery_overfull(self): ++ '''battery which reports a > 100% percentage for a full battery''' ++ ++ self.testbed.add_device('power_supply', 'BAT0', None, ++ ['type', 'Battery', ++ 'present', '1', ++ 'status', 'Full', ++ 'current_now', '1000', ++ 'charge_now', '11000000', ++ 'charge_full', '10000000', ++ 'charge_full_design', '11000000', ++ 'capacity', '110', ++ 'voltage_now', '12000000'], []) ++ ++ self.start_daemon() ++ devs = self.proxy.EnumerateDevices() ++ self.assertEqual(len(devs), 1) ++ bat0_up = devs[0] ++ ++ # should clamp percentage ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Percentage'), 100.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'IsPresent'), True) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'State'), ++ UP_DEVICE_STATE_FULLY_CHARGED) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Energy'), 132.0) ++ # should adjust EnergyFull to reality, not what the battery claims ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'EnergyFull'), 132.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'EnergyFullDesign'), 132.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Voltage'), 12.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'PowerSupply'), True) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Type'), 2) ++ self.stop_daemon() ++ + def test_battery_temperature(self): + '''battery which reports temperature''' + +diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c +index 8020277..b953d65 100644 +--- a/src/linux/up-device-supply.c ++++ b/src/linux/up-device-supply.c +@@ -708,6 +708,10 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply) + /* get a precise percentage */ + if (sysfs_file_exists (native_path, "capacity")) { + percentage = sysfs_get_double (native_path, "capacity"); ++ if (percentage < 0.0f) ++ percentage = 0.0f; ++ if (percentage > 100.0f) ++ percentage = 100.0f; + /* for devices which provide capacity, but not {energy,charge}_now */ + if (energy < 0.1f && energy_full > 0.0f) + energy = energy_full * percentage / 100; +-- +2.6.4 + diff --git a/source/a/upower/patches/linux-Detect-docked-docking-stations-correctly.patch b/source/a/upower/patches/linux-Detect-docked-docking-stations-correctly.patch new file mode 100644 index 00000000..bed83d8e --- /dev/null +++ b/source/a/upower/patches/linux-Detect-docked-docking-stations-correctly.patch @@ -0,0 +1,84 @@ +From a6e830cd652a086161f04b049c84283e0573881b Mon Sep 17 00:00:00 2001 +From: Bastien Nocera <hadess@hadess.net> +Date: Wed, 15 Feb 2012 17:50:00 +0000 +Subject: [PATCH 3/3] linux: Detect docked docking stations correctly + +Instead of counting the number of graphics outputs, check +all the devices the platform/dock_station subsystem that +export a "dock_station" type. + +Based on patch by Armando Di Cianno <armando@goodship.net> + +https://bugs.freedesktop.org/show_bug.cgi?id=36818 +--- + src/linux/up-dock.c | 38 +++++++++++++++++++------------------- + 1 file changed, 19 insertions(+), 19 deletions(-) + +diff --git a/src/linux/up-dock.c b/src/linux/up-dock.c +index f9a7c67..4fe904e 100644 +--- a/src/linux/up-dock.c ++++ b/src/linux/up-dock.c +@@ -46,22 +46,23 @@ G_DEFINE_TYPE (UpDock, up_dock, G_TYPE_OBJECT) + * up_dock_device_check: + **/ + static gboolean +-up_dock_device_check (GUdevDevice *d) ++up_dock_device_check (GUdevDevice *device) + { +- const gchar *status; +- gboolean ret = FALSE; +- +- /* Get the boolean state from the kernel -- note that ideally +- * the property value would be "1" or "true" but now it's +- * set in stone as ABI. Urgh. */ +- status = g_udev_device_get_sysfs_attr (d, "status"); +- if (status == NULL) +- goto out; +- ret = (g_strcmp0 (status, "connected") == 0); +- g_debug ("graphics device %s is %s", +- g_udev_device_get_sysfs_path (d), +- ret ? "on" : "off"); +-out: ++ gint docked; ++ gboolean ret; ++ ++ /* Is it a docking station? */ ++ if (g_strcmp0 (g_udev_device_get_sysfs_attr (device, "dock_type"), "dock_station") != 0) ++ return FALSE; ++ ++ /* Get the boolean state from the kernel */ ++ if (g_udev_device_get_sysfs_attr (device, "docked") == NULL) ++ return FALSE; ++ ++ docked = g_udev_device_get_sysfs_attr_as_int (device, "docked"); ++ ret = (docked == 1); ++ g_debug ("dock_station %s is %s", g_udev_device_get_sysfs_path (device), ret ? "docked" : "undocked"); ++ + return ret; + } + +@@ -76,10 +77,9 @@ up_dock_refresh (UpDock *dock) + GUdevDevice *native; + guint count = 0; + +- /* the metric we're using here is that a machine is docked when +- * there is more than one active output */ ++ /* check to see if there are any docking stations, and if they are docked */ + devices = g_udev_client_query_by_subsystem (dock->priv->gudev_client, +- "drm"); ++ "platform/dock_station"); + for (l = devices; l != NULL; l = l->next) { + native = l->data; + count += up_dock_device_check (native); +@@ -163,7 +163,7 @@ up_dock_uevent_signal_handler_cb (GUdevClient *client, const gchar *action, + static void + up_dock_init (UpDock *dock) + { +- const gchar *subsystems[] = { "drm", NULL}; ++ const gchar *subsystems[] = { "platform/dock_station", NULL}; + dock->priv = UP_DOCK_GET_PRIVATE (dock); + dock->priv->gudev_client = g_udev_client_new (subsystems); + g_signal_connect (dock->priv->gudev_client, "uevent", +-- +2.6.4 + diff --git a/source/a/upower/patches/linux-Properly-detect-bluetooth-mice-and-keyboards-t.patch b/source/a/upower/patches/linux-Properly-detect-bluetooth-mice-and-keyboards-t.patch new file mode 100644 index 00000000..55de33b7 --- /dev/null +++ b/source/a/upower/patches/linux-Properly-detect-bluetooth-mice-and-keyboards-t.patch @@ -0,0 +1,141 @@ +From 6c706ff03365e462e1b076155428decbed0f55c6 Mon Sep 17 00:00:00 2001 +From: Marc Deslauriers <marc.deslauriers@ubuntu.com> +Date: Mon, 4 May 2015 19:31:31 -0400 +Subject: [PATCH] linux: Properly detect bluetooth mice and keyboards that are + HID devices + +https://bugs.freedesktop.org/show_bug.cgi?id=90222 +--- + src/linux/integration-test | 41 +++++++++++++++++++++++++++++++++++++ + src/linux/up-device-supply.c | 48 ++++++++++++++++++++++++++++---------------- + 2 files changed, 72 insertions(+), 17 deletions(-) + +diff --git a/src/linux/integration-test b/src/linux/integration-test +index ad7152a..b83f80d 100755 +--- a/src/linux/integration-test ++++ b/src/linux/integration-test +@@ -761,6 +761,47 @@ class Tests(unittest.TestCase): + self.assertEqual(self.get_dbus_dev_property(mb1_up, 'Percentage'), 30) + self.assertEqual(self.get_dbus_dev_property(mb1_up, 'PowerSupply'), False) + ++ def test_bluetooth_hid_mouse(self): ++ '''bluetooth HID mouse battery''' ++ ++ self.testbed.add_device('hid', ++ 'usb1/bluetooth/hci0/hci0:01', ++ None, ++ [], []) ++ ++ self.testbed.add_device( ++ 'input', ++ 'usb1/bluetooth/hci0/hci0:01/input/input2/mouse3', ++ None, ++ [], ['DEVNAME', 'input/mouse3', 'ID_INPUT_MOUSE', '1']) ++ ++ self.testbed.add_device( ++ 'power_supply', ++ 'usb1/bluetooth/hci0/hci0:01/1/power_supply/hid-00:11:22:33:44:55-battery', ++ None, ++ ['type', 'Battery', ++ 'scope', 'Device', ++ 'present', '1', ++ 'online', '1', ++ 'status', 'Discharging', ++ 'capacity', '30', ++ 'model_name', 'Fancy BT mouse'], ++ []) ++ ++ self.start_daemon() ++ devs = self.proxy.EnumerateDevices() ++ self.assertEqual(len(devs), 1) ++ mousebat0_up = devs[0] ++ ++ self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'Model'), 'Fancy BT mouse') ++ self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'Percentage'), 30) ++ self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'PowerSupply'), False) ++ # 5 == mouse ++ self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'Type'), 5) ++ self.assertEqual(self.get_dbus_property('OnBattery'), False) ++ self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_NONE) ++ self.stop_daemon() ++ + def test_bluetooth_keyboard(self): + '''bluetooth keyboard battery''' + +diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c +index 1f86382..b96080b 100644 +--- a/src/linux/up-device-supply.c ++++ b/src/linux/up-device-supply.c +@@ -932,9 +932,12 @@ up_device_supply_coldplug (UpDevice *device) + const gchar *scope; + gchar *device_type = NULL; + gchar *input_path = NULL; ++ gchar *subdir = NULL; + GDir *dir = NULL; + GError *error = NULL; + UpDeviceKind type = UP_DEVICE_KIND_UNKNOWN; ++ guint i; ++ const char *class[] = { "hid", "bluetooth" }; + + up_device_supply_reset_values (supply); + +@@ -970,28 +973,39 @@ up_device_supply_coldplug (UpDevice *device) + if (g_ascii_strcasecmp (device_type, "mains") == 0) { + type = UP_DEVICE_KIND_LINE_POWER; + } else if (g_ascii_strcasecmp (device_type, "battery") == 0) { ++ for (i = 0; i < G_N_ELEMENTS(class) && type == UP_DEVICE_KIND_UNKNOWN; i++) { ++ /* Detect if the battery comes from bluetooth keyboard or mouse. */ ++ bluetooth = g_udev_device_get_parent_with_subsystem (native, class[i], NULL); ++ if (bluetooth != NULL) { ++ device_path = g_udev_device_get_sysfs_path (bluetooth); ++ ++ /* There may be an extra subdirectory here */ ++ subdir = g_build_filename (device_path, "input", NULL); ++ if (!g_file_test (subdir, G_FILE_TEST_IS_DIR)) { ++ g_free(subdir); ++ subdir = g_strdup (device_path); ++ } + +- /* Detect if the battery comes from bluetooth keyboard or mouse. */ +- bluetooth = g_udev_device_get_parent_with_subsystem (native, "bluetooth", NULL); +- if (bluetooth != NULL) { +- device_path = g_udev_device_get_sysfs_path (bluetooth); +- if ((dir = g_dir_open (device_path, 0, &error))) { +- while ((file = g_dir_read_name (dir))) { +- /* Check if it is an input device. */ +- if (g_str_has_prefix (file, "input")) { +- input_path = g_build_filename (device_path, file, NULL); +- break; ++ if ((dir = g_dir_open (subdir, 0, &error))) { ++ while ((file = g_dir_read_name (dir))) { ++ /* Check if it is an input device. */ ++ if (g_str_has_prefix (file, "input")) { ++ input_path = g_build_filename (subdir, file, NULL); ++ break; ++ } + } ++ g_dir_close (dir); ++ } else { ++ g_warning ("Can not open folder %s: %s", device_path, error->message); ++ g_error_free (error); + } +- g_dir_close (dir); +- } else { +- g_warning ("Can not open folder %s: %s", device_path, error->message); +- g_error_free (error); ++ g_free (subdir); ++ g_object_unref (bluetooth); + } +- g_object_unref (bluetooth); +- } + +- if (input_path != NULL) { ++ if (input_path == NULL) ++ continue; ++ + if ((dir = g_dir_open (input_path, 0, &error))) { + while ((file = g_dir_read_name (dir))) { + /* Check if it is a mouse device. */ +-- +2.6.3 + diff --git a/source/a/upower/patches/rules-Add-support-for-Logitech-G700s-G700-Gaming-Mou.patch b/source/a/upower/patches/rules-Add-support-for-Logitech-G700s-G700-Gaming-Mou.patch new file mode 100644 index 00000000..1826c416 --- /dev/null +++ b/source/a/upower/patches/rules-Add-support-for-Logitech-G700s-G700-Gaming-Mou.patch @@ -0,0 +1,23 @@ +From 305f62adf052aa972523d083ca44d3050f659ec9 Mon Sep 17 00:00:00 2001 +From: muzena <trebelnik2@gmail.com> +Date: Wed, 8 Jul 2015 17:11:25 +0200 +Subject: [PATCH 4/4] rules: Add support for Logitech G700s/G700 Gaming Mouse + +https://bugs.freedesktop.org/show_bug.cgi?id=91270 +--- + rules/95-upower-csr.rules | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/rules/95-upower-csr.rules b/rules/95-upower-csr.rules +index 39539ca..3b83665 100644 +--- a/rules/95-upower-csr.rules ++++ b/rules/95-upower-csr.rules +@@ -29,4 +29,5 @@ ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", DRIVER=="logitech-djdevice", + ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", DRIVER=="logitech-hidpp-device", ENV{UPOWER_BATTERY_TYPE}="unifying" + ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", DRIVER=="logitech-hidpp-device", ENV{UPOWER_BATTERY_TYPE}="unifying" + ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52f", ENV{UPOWER_BATTERY_TYPE}="lg-wireless" ++ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c531", ENV{UPOWER_BATTERY_TYPE}="lg-wireless" + LABEL="up_unifying_end" +-- +2.6.4 + diff --git a/source/a/upower/patches/rules-support-Logitech-Unifying-in-Linux-3.19.patch b/source/a/upower/patches/rules-support-Logitech-Unifying-in-Linux-3.19.patch new file mode 100644 index 00000000..adcba238 --- /dev/null +++ b/source/a/upower/patches/rules-support-Logitech-Unifying-in-Linux-3.19.patch @@ -0,0 +1,30 @@ +From f8104a112eb967cd4c2aaf57b5a59aafe7c4738f Mon Sep 17 00:00:00 2001 +From: Peter Wu <peter@lekensteyn.nl> +Date: Wed, 21 Jan 2015 15:56:23 +0100 +Subject: [PATCH] rules: support Logitech Unifying in Linux 3.19 + +Linux 3.19 changed the way in which devices get registered by +introducing a hid-logitech-hidpp module. The driver name therefore needs +to be adjusted. + +Signed-off-by: Peter Wu <peter@lekensteyn.nl> +--- + rules/95-upower-csr.rules | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/rules/95-upower-csr.rules b/rules/95-upower-csr.rules +index b476660..39539ca 100644 +--- a/rules/95-upower-csr.rules ++++ b/rules/95-upower-csr.rules +@@ -25,5 +25,8 @@ SUBSYSTEM!="hid", GOTO="up_unifying_end" + ATTRS{idVendor}=="046d", ENV{UPOWER_VENDOR}="Logitech, Inc." + ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", DRIVER=="logitech-djdevice", ENV{UPOWER_BATTERY_TYPE}="unifying" + ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", DRIVER=="logitech-djdevice", ENV{UPOWER_BATTERY_TYPE}="unifying" ++# These devices bind to the hid-logitech-hidpp module since Linux 3.19 ++ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", DRIVER=="logitech-hidpp-device", ENV{UPOWER_BATTERY_TYPE}="unifying" ++ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", DRIVER=="logitech-hidpp-device", ENV{UPOWER_BATTERY_TYPE}="unifying" + ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52f", ENV{UPOWER_BATTERY_TYPE}="lg-wireless" + LABEL="up_unifying_end" +-- +2.6.3 + diff --git a/source/a/upower/patches/upower-pm-utils-0.9.23-fix-segfault.patch b/source/a/upower/patches/upower-pm-utils-0.9.23-fix-segfault.patch new file mode 100644 index 00000000..3e897632 --- /dev/null +++ b/source/a/upower/patches/upower-pm-utils-0.9.23-fix-segfault.patch @@ -0,0 +1,24 @@ +From 0d64bbddaa0078ef148d609a3cfad854cf00d7de Mon Sep 17 00:00:00 2001 +From: Martin Pitt <martinpitt@gnome.org> +Date: Fri, 08 Nov 2013 13:59:50 +0000 +Subject: lib: Fix segfault on getting property when daemon is not running + +This fixes "upower --version" when the daemon is not running, and thus the +client proxy is NULL. +--- +diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c +index 35d7b5d..17fb02d 100644 +--- a/libupower-glib/up-client.c ++++ b/libupower-glib/up-client.c +@@ -322,6 +322,9 @@ up_client_get_property (GObject *object, + UpClient *client; + client = UP_CLIENT (object); + ++ if (client->priv->proxy == NULL) ++ return; ++ + switch (prop_id) { + case PROP_DAEMON_VERSION: + g_value_set_string (value, up_client_glue_get_daemon_version (client->priv->proxy)); +-- +cgit v0.9.0.2-2-gbebe diff --git a/source/a/upower/upower.SlackBuild b/source/a/upower/upower.SlackBuild index e5831960..93b2a69a 100755 --- a/source/a/upower/upower.SlackBuild +++ b/source/a/upower/upower.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for upower -# Copyright 2010, 2011 Robby Workman, Northport, Alabama, USA +# Copyright 2010, 2011, 2015 Robby Workman, Tuscaloosa, Alabama, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -27,7 +27,7 @@ PKGNAM=upower VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d- | rev)} -BUILD=${BUILD:-1} +BUILD=${BUILD:-3} NUMJOBS=${NUMJOBS:--j7} @@ -35,7 +35,7 @@ NUMJOBS=${NUMJOBS:--j7} MARCH=$( uname -m ) if [ -z "$ARCH" ]; then case "$MARCH" in - i?86) export ARCH=i486 ;; + i?86) export ARCH=i586 ;; armv7hl) export ARCH=$MARCH ;; arm*) export ARCH=arm ;; # Unless $ARCH is already set, use uname -m for all other archs: @@ -43,8 +43,8 @@ if [ -z "$ARCH" ]; then esac fi -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" @@ -82,6 +82,15 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +zcat $CWD/patches/upower-pm-utils-0.9.23-fix-segfault.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/patches/linux-Properly-detect-bluetooth-mice-and-keyboards-t.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/patches/rules-support-Logitech-Unifying-in-Linux-3.19.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/patches/linux-Clamp-percentage-for-overfull-batteries.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/patches/linux-Detect-docked-docking-stations-correctly.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/patches/Fix-HID-rules-header-as-per-discussions.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/patches/Update-UPower-HID-rules-supported-devices-list.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/patches/rules-Add-support-for-Logitech-G700s-G700-Gaming-Mou.patch.gz | patch -p1 --verbose || exit 1 + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ @@ -93,6 +102,7 @@ CXXFLAGS="$SLKCFLAGS" \ --docdir=/usr/doc/$PKGNAM-$VERSION \ --disable-static \ --enable-man-pages \ + --enable-deprecated \ --build=$TARGET make $NUMJOBS || make || exit 1 |