Commit Graph

217 Commits

Author SHA1 Message Date
Peter Wu b2a62c2dd7 special_keys: update controls list
My previous observation was right, controls and tasks are really different
entities. The following "controls" appears to be invalid and have been removed:

    Home=0x001A,
    Music=0x001D,
    Search=0x0029,
    Sleep=0x002F,
2013-05-27 11:44:20 +02:00
Peter Wu 6ae11f862c Add more feature names, rename existing ones
Extracted from SetPoint 6.52.74 software using:

    <FeaturesSupported.xml awk -F\" '/<Feature /{sub(/^LD_FID_/, "", $2); printf("\t%s=%s,\n", $2, $4)}' | sort -t= -k2

Existing names are renamed to the newer, verbose names.
2013-05-26 23:47:40 +02:00
Peter Wu 28c35633d3 Add more tasks for special keys
Based on tasks.xml from `%ProgramFiles%\\SetPointP\\tasks.xml`.
2013-05-26 22:47:03 +02:00
Peter Wu 6e36e33b22 Decouple controls from tasks (programmable keys)
They are treated differently in the HID++ 2.0 specification. Observations seem
to confirm this difference. For instance, a part of solaar-cli's output:

	0: unknown:0022         => Home                   FN sensitive, is FN, reprogrammable
	1: Mail                 => Mail                   FN sensitive, is FN, reprogrammable
	2: unknown:003E         => Search                 FN sensitive, is FN, reprogrammable
2013-05-26 22:47:03 +02:00
Daniel Pavel e73f076324 don't support the VX Nano right now 2013-05-22 20:43:29 +03:00
Daniel Pavel 131f8f7f45 disable status polling on devices
the regular flow should be reading the battery on all devices now
2013-05-22 20:42:26 +03:00
Daniel Pavel c3b73964d5 improved support for some Nano receivers 2013-05-22 20:41:11 +03:00
Daniel Pavel 790fc7c04b improved support for the Nano receiver 2013-05-22 07:31:16 +03:00
Peter Wu 9c0dac044c hid10: update 07 battery parsing based on spec
This fixes pwr/Solaar#49 partially, at least the charging state will be reported
correctly hereafter. The charge level may still be incorrect though.
2013-05-22 00:10:17 +02:00
Daniel Pavel da6711c93c the 'Solar key' on K750 is named 'Light Check button' 2013-05-21 00:48:21 +03:00
Daniel Pavel d3dcdcb92e Merge remote-tracking branch 'origin/master' 2013-05-19 11:54:38 +03:00
Peter Wu f0542923d7 hid10: update flags description for notifications
The Logitech HID++ 1.0 documentation actually names the fields for devices and
receiver. Clarify that and explain why enabling all of the bits is a bad idea.
2013-05-19 10:30:41 +02:00
Peter Wu 29d0c07164 hid10: Formatting and re-order NOTIFICATION_FLAGs
Align values for easier reading the numeric values of NOTIFICATION_FLAGs.  To
maintain consistency in the ordering of the values, swap keyboard_backlight with
keyboard_present.
2013-05-19 10:20:21 +02:00
Peter Wu 152abb086a hid10: document notifications better
See [registers.txt][1] for 'keyboard_backlight'. The behavior of
keyboard_sleep_raw and keyboard_multimedia_raw is described at
[keyboard.txt][2].

 [1]: https://git.lekensteyn.nl/ltunify/tree/registers.txt
 [2]: https://git.lekensteyn.nl/ltunify/tree/keyboard.txt
2013-05-19 10:14:31 +02:00
Daniel Pavel ef62892f60 pop up a desktop notification if the battery is below 5% 2013-05-18 14:35:33 +03:00
Daniel Pavel 7ae24488d9 only notify on connected devices at start-up 2013-05-18 02:20:22 +03:00
Daniel Pavel 317cf6d00f only enable certain notification flags on devices
Also added some documentation to the notification flags, where possible.
2013-05-18 00:15:42 +03:00
Daniel Pavel a5eeac6e5a enable notifications for peripherals; fixes #27 2013-05-17 23:06:24 +03:00
Daniel Pavel c20b279362 minor tweaks 2013-05-08 12:06:01 +03:00
Daniel Pavel 8d5ca66db7 get rid of bad map() calls 2013-05-06 17:51:03 +02:00
Daniel Pavel 3ecfdd027e handle all 07/0D register notifications 2013-05-06 17:08:58 +02:00
Daniel Pavel 55ca9927b0 python 2/3: fix handling of first argument (unicode) of pack/unpack 2013-05-06 16:50:17 +02:00
Daniel Pavel 0283bb0e91 fix str/unicode detection in Python 3.2 2013-05-06 15:33:42 +02:00
Daniel Pavel d39c0995b6 Merge remote-tracking branch 'origin/master' 2013-05-06 14:55:21 +02:00
Daniel Pavel db4c088ce9 Merge pull request #37 from Lekensteyn/py3-compat
Py3 compat: replace use of "unicode" (pwr/Solaar#32)

The `u''` syntax fails in Python 3.2; will fix is_string after the merge.
2013-05-06 05:54:53 -07:00
Daniel Pavel a4898e24b7 extended documentation of descriptors and registers 2013-05-06 14:51:57 +02:00
Daniel Pavel 1f48e44cc6 Merge remote-tracking branch 'origin/master' 2013-05-04 20:20:43 +02:00
Daniel Pavel 9d8743e765 comment-out descriptor settings for Anywhere MX, not actually tested 2013-05-04 20:18:10 +02:00
Peter Wu 2327a0012e descriptors.py: Clarify use of negative values
The negative behavior is not obvious, document it in the descriptors.py file
such that people who edit it to add new devices know how it works.
2013-05-04 20:02:37 +02:00
Daniel Pavel e819265e7e fix automatic register blacklisting 2013-05-04 19:50:08 +02:00
Daniel Pavel d7dd9393ff minor clean-ups 2013-05-04 17:19:48 +02:00
Daniel Pavel 64c36a1562 updated descriptors table and the devices doc 2013-05-04 17:18:39 +02:00
Daniel Pavel 13a54565ba cleaned-up the descriptors table 2013-05-04 15:09:50 +02:00
Daniel Pavel ad577d22d0 handle sleep in udev monitoring, fixes #35 2013-05-04 12:19:29 +02:00
Peter Wu 10c26fe642 Py3 compat: replace use of "unicode" (pwr/Solaar#32)
Generating "an unknown notification" type bailed out because of an unknown
feature type None. Since `isinstance(other, str)` is False for None, the script
will raise an exception on `isinstance(other, unicode)`.

There is no differentiation between `str` and `bytes` in Python 2, therefore
add another condition to `NamedInt.__eq__` to catch unknown types (like
`bytes`).
2013-05-03 23:46:46 +02:00
Daniel Pavel 2ee2a5dc46 Merge remote-tracking branch 'origin/master' 2013-05-03 17:08:32 +02:00
Daniel Pavel 430fdf4fcf initial support for the MOUSE_POINTER hid++2.0 feature 2013-05-03 17:08:26 +02:00
Daniel Pavel a0a76f738b assert that data read/written on the receiver handle is of type bytes 2013-05-03 16:35:28 +02:00
Peter Wu 266edd80f3 Process reg07 battery notification 2013-05-03 00:10:58 +02:00
Peter Wu d1b1be32ca Make read_battery use set_battery_info
This allows battery readouts to generate warnings and debug logs for a given
status and level.
2013-05-02 23:56:08 +02:00
Peter Wu fbdd923d43 Refactor battery info update
- `self[BATTERY_STATUS] = BATTERY_STATUS[battery_status]` should be:
  `self[BATTERY_STATUS] = _hidpp20.BATTERY_STATUS[battery_status]`, otherwise
  the battery status would be a single char from the string `battery-status`.
- Make `_hidpp20.BATTERY_OK` check against strings instead of a number.
- Move setting battery information to a separate function, `set_battery_info`.
  This prepares for notifications when a battery error/warning occurs.
2013-05-02 23:51:40 +02:00
Peter Wu d8e469a33a hidpp10: split reg07 (battery) parsing so it can be reused 2013-05-02 23:06:45 +02:00
Daniel Pavel 0f80901bce quicker detection of matching receivers in udev 2013-05-02 11:11:53 +02:00
Daniel Pavel c829304e31 use only udev events to detect receiver devices 2013-05-01 15:47:23 +02:00
Daniel Pavel d3f94ff2fb detect some HID++1.0 custom battery notifications
they're not handled yet
2013-05-01 11:36:15 +02:00
Daniel Pavel 04db6d3838 python 3 fixes for #29 2013-04-30 22:31:06 +02:00
Daniel Pavel feedbcf581 some code clean-ups 2013-04-28 15:16:45 +02:00
Daniel Pavel a57f3be58d renamed event alert levels to be more clear 2013-04-28 15:12:20 +02:00
Daniel Pavel 897dffc426 only dispatch notification events from the specialized listener thread 2013-04-28 15:09:09 +02:00
Daniel Pavel 6f0b61e6d8 better handling of eq/ne/hash in receiver and device objects 2013-04-28 15:02:17 +02:00
Daniel Pavel 674ee9ac9e split read_battery in status into its own function 2013-04-28 15:01:27 +02:00
Daniel Pavel 5eab013cf6 more explicit logging 2013-04-28 14:58:40 +02:00
Daniel Pavel 079ef8d800 incipient support for the Nano receiver 2013-04-28 14:27:16 +02:00
Daniel Pavel c4dc49ac5e Merge pull request #24 from Lekensteyn/hid10-fnkey
Add FN key swap support for K800 (and presumably K710)
2013-04-28 02:03:33 -07:00
Peter Wu 5e58f1e273 Fix battery status reading, add "fully charged"
Commit 438c501fae introduced support for HID++ 1.0
battery information. That accidentally selected the third parameter instead of
the second one. This commit fixes that and additionally adds a "fully charged"
status too that was found on the K800.
2013-04-27 17:07:55 +02:00
Peter Wu c79ad65d37 Add K710 with FN key swap support (pwr/Solaar#18)
The K710 keyboard is (according to the issue reporter) part of a MK710 combo
(which also contains a M705 mouse). Observing a succesful 07 register read,
I think that it is a HID++ 1.0 device too that uses the same register for FN
key swapping as K800.
2013-04-27 15:17:05 +02:00
Peter Wu 95a97ad776 Support FN keys swap for K800 2013-04-27 15:13:42 +02:00
Peter Wu 6c28cedf23 Make BooleanValidator accept bytes too besides int
Previously, only the first parameter byte can be read or written. After this
patch, it is possible to select/write more bytes by specifying a mask of type
bytes with the appropriate length.
2013-04-27 15:12:55 +02:00
Peter Wu 438c501fae Parse battery status of HID++ 1.0 devices
This applies to K800 but it seems also to apply to M510. The numbers are based
on the HID++ 2.0 spec that state the following for GetBatteryCapability:

    If number of levels < 10 or if mileage is disabled then report are
    mapped to 4 levels this way.

    0%->10%     critical
    11%->30%    low
    31%->80%    good
    81%->100%   full

    i.e. to report battery low, FW send 25%, to report battery good, FW send 50%.
2013-04-27 11:58:09 +02:00
Daniel Pavel 7707c5e558 don't notify on device disconnection 2013-01-18 17:41:45 +02:00
Daniel Pavel 2e51380be5 log value of register 0x07 when register 0x0D not available 2013-01-18 12:41:01 +02:00
Daniel Pavel 581d6747ad Merge branch 'nano' into 0.9
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2013-01-09 21:10:39 +02:00
Daniel Pavel 79a9048db5 fixed names for NamedInts numerical values 2013-01-09 15:31:19 +02:00
Daniel Pavel 738d43fd83 fix for gihub issue #10
http://github.com/pwr/Solaar/issues/10
2013-01-07 20:14:31 +02:00
Daniel Pavel 36f34da227 proper debian packaging, dropper stdeb 2013-01-05 11:48:35 +02:00
Daniel Pavel 064a7a113c added setup.py for python and debian packaging 2012-12-18 05:03:43 +02:00
Daniel Pavel 430a2d71e3 read all device features as soon as the application is idle 2012-12-14 19:51:18 +02:00
Daniel Pavel e43e92f2b0 commented-out testing register for M705 2012-12-14 16:57:10 +02:00
Daniel Pavel cc6c0ee7df fix for python3 2012-12-14 16:25:46 +02:00
Daniel Pavel f0c5046ccf re-worked the settings classes 2012-12-14 06:44:44 +02:00
Daniel Pavel 9db2a65b31 solaar-cli: return on the first match when searching for device name
results may be occasionally ambiguous, but the command runs faster
2012-12-13 15:12:51 +02:00
Daniel Pavel b39016df7c small clean-ups in device status handling 2012-12-13 14:54:31 +02:00
Daniel Pavel c22fe6320d properly slice NamedInts 2012-12-13 05:26:56 +02:00
Daniel Pavel b99ccdf612 support slices in FeaturesArray and KeysArray 2012-12-13 03:34:39 +02:00
Daniel Pavel 2d338ffbfb better __str__ of Setting instances 2012-12-13 03:33:19 +02:00
Daniel Pavel 954fc29613 fix event storm when toggling a device's property 2012-12-12 22:55:04 +02:00
Daniel Pavel 27f10cd10e small clean-up in FeaturesArray, should be slightly faster 2012-12-12 21:44:37 +02:00
Daniel Pavel 1c4d3d5f13 simpler NamedInt, more logical NamedInts 2012-12-12 21:42:43 +02:00
Daniel Pavel 7bb7a092a4 descriptors update (new device K230)
also assume by default all devices have battery info in register 0x0D,
and blacklist them when that's not the case
2012-12-12 21:41:29 +02:00
Daniel Pavel 0ed623caf9 made notifications handling clearer in status.py 2012-12-12 21:39:04 +02:00
Daniel Pavel 19cd40cfdd renamed 'events' to 'notifications'
in order to match the name in Logitech's documentation
2012-12-12 21:03:07 +02:00
Daniel Pavel 17698bfeae minor clean-ups in texts 2012-12-12 20:44:29 +02:00
Daniel Pavel fa72b89b3a release 0.8.3 2012-12-08 05:29:50 +02:00
Daniel Pavel 80c36a02a9 improved notifications detection 2012-12-08 01:49:59 +02:00
Daniel Pavel d38bec39b6 improved hid++ support 2012-12-08 00:41:43 +02:00
Daniel Pavel 30fedf418c re-read device settings when they come back online 2012-12-07 21:00:36 +02:00
Daniel Pavel ee16892481 fixed registers access 2012-12-07 20:38:24 +02:00
Daniel Pavel e2909f6165 fixed event detection 2012-12-07 20:37:13 +02:00
Daniel Pavel b86dcce381 I come from the __future__, come with me if you want to live. 2012-12-07 17:10:22 +02:00
Daniel Pavel c4be58f074 dropped bin/scan as deprecated, bin/solaar-cli completely replaces it 2012-12-07 15:31:19 +02:00
Daniel Pavel b3f0bfa4fb fixed obsolete import 2012-12-07 14:41:00 +02:00
Daniel Pavel 67db483b0b dropped the unittests, they've been obsolete and nonfunctional for a long time now 2012-12-07 14:00:28 +02:00
Daniel Pavel 3569489ce7 added registers and settings to device descriptors 2012-12-07 13:54:03 +02:00
Daniel Pavel 9066003240 named ints act like proper sequences now 2012-12-07 13:50:44 +02:00
Daniel Pavel ff6db1d00a fix for python 3 2012-12-06 14:15:28 +02:00
Daniel Pavel 27403a08d2 improved hid++ 1.0 support 2012-12-05 21:41:02 +02:00
Daniel Pavel 6d70d2aada improved support for hid++ 1.0 devices 2012-12-05 15:10:41 +02:00
Daniel Pavel 5a99e55309 readme updates 2012-12-03 15:07:35 +02:00
Daniel Pavel 116ba72f37 fixed possible dangling weakrefs on start-up 2012-12-03 12:51:22 +02:00
Daniel Pavel 3fe9caf0e6 added solaar-cli for command-line operations 2012-12-03 11:34:35 +02:00