Merge remote-tracking branch 'origin/master'

This commit is contained in:
Daniel Pavel 2013-05-22 01:21:34 +03:00
commit d46e603366
3 changed files with 38 additions and 12 deletions

View File

@ -27,23 +27,22 @@ You can run the `rules.d/install.sh` script from Solaar to do this installation
automatically (it will switch to root when necessary), or you can do all the automatically (it will switch to root when necessary), or you can do all the
required steps by hand, as the root user: required steps by hand, as the root user:
1. copy `rules.d/99-logitech-unfiying-receiver.rules` from Solaar to 1. Copy `rules.d/99-logitech-unifying-receiver.rules` from Solaar to
`/etc/udev/rules.d/` `/etc/udev/rules.d/`. udev will automatically pick up this file using
inotify.
By default, the rule makes the Unifying Receiver device available for r/w by By default, the rule allows all members of the `plugdev` group to have
all users belonging to the `plugdev` system group (standard Debian/Ubuntu read/write access to the Unifying Receiver device. (standard Debian/ Ubuntu
group for pluggable devices). It may need changes, specific to your group for pluggable devices). It may need changes, specific to your
particular system's configuration. If in doubt, replacing `GROUP="plugdev"` particular system's configuration. If in doubt, replacing `GROUP="plugdev"`
with `GROUP="<your username>"` should just work. with `GROUP="<your username>"` should just work.
2. run `udevadm control --reload-rules` to let the udev daemon know about the 2. Physically remove the Unifying Receiver and re-insert it.
new rule
3. physically remove the Unifying Receiver, wait 10 seconds and re-insert it
This is necessary because if the receiver is already plugged-in, it already This is necessary because if the receiver is already plugged-in, it already
has a `/dev/hidraw?` device node, but with the old (`root:root`) permissions. has a `/dev/hidraw?` device node, but with the old (`root:root`) permissions.
Plugging it again will re-create the device node with the right permissions. Plugging it again will re-create the device node with the right permissions.
4. make sure your desktop users are part of the `plugdev` group, by running 3. Make sure your desktop users are part of the `plugdev` group, by running
`adduser <linux user> plugdev` as root `gpasswd $USER plugdev` as root. If these users were not assigned to the
group before, they must re-login for the changes to take effect.

View File

@ -0,0 +1,26 @@
The battery/charging level and status is reported only if the related
reporting flag in register 0x00 is enabled by the host. The
"Battery/Charging Level" byte indicates the battery level if the
"Charging State" indicates 0x00 ("Not Charging"). If "Charging State"
indicates 0x21 to 0x23 ("Charging"), the "Battery/Charging Level" byte
indicates the level of charging.
10 ix 07 r0 r1 r2 00
r0 -> Battery/Charging Level
0x00 = Reserved/Unknown
0x01 = Critical
0x02 = Critical (legacy value, don't use)
0x03 = Low
0x04 = Low (legacy value, don't use)
0x05 = Good
0x06 = Good (legacy value, don't use)
0x07 = Full
0x08..0xFF = Reserved
r1 -> Charging state
0x00 = Not charging
0x01..0x1F = Reserved (not charging)
0x20 = Unknown charging state
0x21 = Charging
0x22 = Charging complete
0x23 = Charging error
0x24..0xFF = Reserved

View File

@ -132,9 +132,10 @@ def parse_battery_reply_07(level, battery_status):
else 20 if level == 3 # low else 20 if level == 3 # low
else 5 if level == 1 # critical else 5 if level == 1 # critical
else 0 ) # wtf? else 0 ) # wtf?
status = ('charging' if battery_status == 0x25 status = ('charging' if battery_status == 0x21 or battery_status == 0x25
else 'fully charged' if battery_status == 0x22 else 'fully charged' if battery_status == 0x22
else 'discharging') else 'discharging' if battery_status == 0x00
else None)
return charge, status return charge, status