Enable Hidraw interface on spotlight bluetooth connection - #140
Conversation
67eea21 to
904d9fa
Compare
|
Important Note: The spotlight device is designed for only one active connection at a time. The Projecteur seem to not work when device is connected by both means (USB and Bluetooth). However, to correct it press any key on spotlight device. The bluetooth connection will automatically disconnect and Projecteur will be able to work again. |
3dc4282 to
61f1426
Compare
|
Hi @mayanksuman , thank you for your work 👍 - I am currently traveling this weekend - but will review and integrate via feature branch in the next days. |
e9efb50 to
c4a144c
Compare
jahnf
left a comment
There was a problem hiding this comment.
Hi @mayanksuman, I have some remarks. Most are about the sleeps.
If there needs to be a delay between data send to the device, we need a better way - e.g. schedule it with a timer instead of just blocking the main thread.
Also: when pinging the device - why not make sure we get a reply?
c4a144c to
b6bf092
Compare
|
Hi @jahnf , all the comments have taken care of. I have used We are checking the response of ping in async manner. We are not putting a timer with timeout for this case. Rather, the response to all the HID commands are handled in It is not necessary that device send information only on request, sometime like connecting device for charging or other cases, it sends the information on its own. Hence, I thought that instead of checking the response to each HID command, let the HID response come and process it when it is available. |
71945e2 to
e67513e
Compare
This commit enables hidraw interface on logitech spotlight connected via bluetooth. Three major changes are 1. DeviceId (in device.h) now include the information about the bus on which spotlight is connected (USB/Bluetooth). 2. sendData function (device.cc) for hidraw on bluetooth modifies the data before sending it. The bluetooth hid need the data in 20 byte long packages; smaller packet of 7 byte length is not allowed on bluetooth connection. More details for this conversion is provided in the function definition as comment. 3. The projecteur now initialize HID device correctly (Get rid of any device configuration by other programs). The projecteur also pings the device and check the the HID++ version supported by the device. Note: To connect logitech spotlight using bluetooth, press top button and the last button till the led light starting flashing. The spotlight device can now be paired with computer.
e67513e to
cf79056
Compare
|
Hi @mayanksuman What Linux-Distro are you running?
As you collected a lot of experience with the device, what could be the reason for this? Just for information, the Bluetooth device on my machine detected by Projecteur looks like this: |
I am using Debian Testing on my main machine. In your device scan, some sub-device (most probably /dev/hidraw3) is not readable or writable. So, even if the device is sending a connection active packet ({0x11, 0x01, 0x04, ...}), the software (Projecteur) is not able to receive it and hence reports that the device is not active. I think, this is a issue with udev rule. One more point, are you running a virtual machine? I have not tested bluetooth connection on virtual machine, as my machine do not provide mean to pass bluetooth device to virtual machine. |
|
Nope not a virtual machine and all the sub-devices are readable when running as root. Device scan as root: Edit: added addtional udev rules, so that as a user all sub-devices are now readable - issue remains the same when running as a regular user. - Don't have too much time now to investigate further, but any idea that you have is appreciated - will investigate more later this week. |
|
Hi @jahnf , My mistake. Device activation packet is only sent in case of USB connection. If device is connected on Please change the You can directly merge #142 in your feature branch with this fix. |
|
Thanks, works now - will review the battery PR within the next days. |
|
Ok ... |
|
Yes that would be helpful - I'd like to do tests on the feature branch for multiple systems before finally merging to develop. |
|
Ok ... I will rebase and push on that PR. |
This commit enables hidraw interface on logitech spotlight connected via
bluetooth. Three major changes are
which spotlight is connected (USB/Bluetooth).
before sending it. The bluetooth hid need the data in 20 byte long
packages; smaller packet of 7 byte length is not allowed on bluetooth
connection. More details for this conversion is provided in the
function defintion as comment.
device configuration by other programs). The projecteur also pings
the device and check the the HID++ version supported by the device.
With this code, device can vibrate (and support other functionality as
being worked in #136 ) even if it is connected on bluetooth.
Note: To connect logitech spotlight using bluetooth, press top button
and the last button till the led light starting flashing. The spotlight
device can now be paired with computer.