开发者

How To Get RAW USB Input from wireless Keyboard

I'm Using Ubuntu and have purchased a Logitech K750 Wireless Keyboard that runs on solar power. I would like to use this device not just as a keyboard but also as a light sensor for my office. The keyboard (this I know from the windows tool available for it, that shows the light-level in lux) transmits the current light to the computer thus it should be possible to use it as a sensor.

My question is how to get the data transmitted from the keyboard. I have tried to identify the USB-Port with the help of dmesg, resulting in (these are just the last lines, after I put the usb-receiver in)

[  379.352041] usb 5-1: new full speed USB device using uhci_hcd and address 4
[  379.556188] input: Logitech USB Receiver as /devices/pci0000:00/0000:00:1d.3/usb5/5-1/5-1:1.0/input/input12
[  379.556345] generic-usb 0003:046D:C52B.0005: input,hidraw0: USB HID v1.11 Keyboard [Logitech USB Receiver] on usb-0000:00:1d.3-1/input0
[  379.563530] input: Logitech USB Receiver as /devices/pci0000:00/0000:00:1d.3/usb5/5-1/5-1:1.1/input/input13
[  379.563794] generic-usb 0003:046D:C52B.0006: input,hiddev0,hidraw1: USB HID v1.11 Mouse [Logitech USB Receiver] o开发者_如何学JAVAn usb-0000:00:1d.3-1/input1
[  379.571558] generic-usb 0003:046D:C52B.0007: hiddev0,hidraw2: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:1d.3-1/input2

lsusb gives me

Bus 005 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 005 Device 003: ID 046a:0106 Cherry GmbH 
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I am nut sure what this means however.

I have tried sudo cat /dev/usb/hiddev0, which seemed like a likely solution but no data is displayed. (A while ago I could get the data from my mouse with that command, but now that does not work either)

Does anybody know how to get the data from the device?

Edit sudo cat /dev/tty0 works however I do not seem to get symbols that I can display... the terminal shows "9�9�9�9�� � ��� �� ��".

Edit2 I'm not sure that this signal is even from my keyboard. When I press "aaabbbcccabcd" and then resolve the unreadable text using od -x I get

0000000 1e9e b030 b030 2eae ae2e 9e1e 2030 00a0
0000017

I can't see the pattern...


I did a search on Google recently and I found this website: https://github.com/aheadley/logitech-solar-k750-linux It might be helpful to you and the Linux world. I'm more of a Windows user, so I can't advise much to you with Ubuntu/Linux and Python coding. The source code is in Python language. Hope this helps you get somewhere.


I recently bought this keyboard, and subsequently ran into a blog post by Debian developer Julian Danjou on using upower with Logitech unifying devices and the solar K750 in particular. The post mentions that his work for a lumincance property might land in the next version of upower,v0.9.19. Until that is there, I intend to try out the version in their repository (see the upower page on freedesktop.org).

If you intend to dive into it yourself, that blog (and a previous entry on the K750) note that it uses the HID++ protocol to connect, and links to a draft specification. Yesterday I saw a tweet by Julian Danjou that his work with this is progressing - you might want to contact him directly.

edit - Update: this work is now (partly?) integrated into the gnome power manager (via upower).

Also, this work has been continued and developed into an application for controlling the Logitech Unifying adapter (pairing,unpairing), as well as checking the luminance, called 'Solaar': https://github.com/pwr/Solaar It is a great help :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜