Open Wheels00 opened 2 years ago
You don't need to figure out those details, actually. And the existing mouse filter is not actually a general filter, it fails with most devices I've personally used.
Can you try out the process of updating the sdp_record.xml as described at: https://github.com/ruundii/bthidhub/issues/31#issuecomment-891195536
Thanks @Dreamsorcerer ! So per your suggestion , I swapped the big long hex number in sdp_record.xml to the one in the report description for my trackball. I think I only have one report id and so I assume there's nothing else to change? (btw, i only want to use a mouse; no keyboard necessary).
The result feels somewhat like progress in that x/y movement is sort of coming through to the host if I use "default" filter, but the moment jumps around all over the place. It's definitely not usable .
So next I will try to get hid-tools running on the host (Windows) as well and if I succeed i'll post the two outputs here. But, if the SDP record is the same and bthidhub is just forwarding the data through to the host, i don't understand where the problem could be.
ok, i'm struggling to work out how to run hid-tools or similar on Windows. Any tips?
I've just realised that @ruundii changed the mouse filter code. So my other comment about the mouse filter should be to change the filter code to just:
def filter_message_to_host(self, msg):
return b'\xa1\x03' + msg
But, sdp_record.xml was also changed, so not sure if there are other changes needed. I still don't have anything running to retest with the new code.
ok, i'm struggling to work out how to run hid-tools or similar on Windows. Any tips?
No. I don't use Windows and am only familiar with hid-tools in so far as I have run it to see the output from my own devices. Sorry.
Download an Ubuntu disk and just boot Ubuntu off a USB drive? You can just test it from there without installing anything on your machine.
Good idea re: usb drive ubuntu.
Per @Dreamsorcerer 's excellent suggestion i ran hid-tools from an Ubuntu USB drive.
The difference between the HID events from the mouse directly versus via bthidhub is somewhat illuminating.
Direct:
# ReportID: 1 / Button: 0 0 0 0 0 | # | X: 0 | Y: 0
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.000000 8 01 00 00 00 00 00 00 00
# ReportID: 1 / Button: 0 0 0 0 0 | # | X: 0 | Y: -3
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.159625 8 01 00 00 d0 ff 00 00 00
# ReportID: 1 / Button: 0 0 0 0 0 | # | X: 0 | Y: -1
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.163695 8 01 00 00 f0 ff 00 00 00
# ReportID: 1 / Button: 0 0 0 0 0 | # | X: 0 | Y: -2
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.175529 8 01 00 00 e0 ff 00 00 00
# ReportID: 1 / Button: 0 0 0 0 0 | # | X: 0 | Y: -4
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.179489 8 01 00 00 c0 ff 00 00 00
# ReportID: 1 / Button: 0 0 0 0 0 | # | X: -2 | Y: -9
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.191567 8 01 00 fe 7f ff 00 00 00
# ReportID: 1 / Button: 0 0 0 0 0 | # | X: -6 | Y: -12
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.195507 8 01 00 fa 4f ff 00 00 00
Via bthidhub:
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: 256 | Y: 256
# | Wheel: 0 | AC Pan: 0 | 0x10168: 0
E: 000000.000000 9 01 01 00 01 10 00 00 00 00
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: 0 | Y: -256
# | Wheel: -1 | AC Pan: 0 | 0x10168: 0
E: 000001.028618 9 01 01 00 00 f0 ff 00 00 00
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: -1536 | Y: 2047
# | Wheel: -1 | AC Pan: 0 | 0x10168: 0
E: 000001.079712 9 01 01 00 fa 7f ff 00 00 00
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: -256 | Y: -257
# | Wheel: -1 | AC Pan: 0 | 0x10168: 0
E: 000001.109602 9 01 01 00 ff ef ff 00 00 00
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: -512 | Y: -769
# | Wheel: -1 | AC Pan: 0 | 0x10168: 0
E: 000001.149613 9 01 01 00 fe cf ff 00 00 00
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: -256 | Y: -257
# | Wheel: -1 | AC Pan: 0 | 0x10168: 0
E: 000001.201166 9 01 01 00 ff ef ff 00 00 00
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: -256 | Y: -257
# | Wheel: -1 | AC Pan: 0 | 0x10168: 0
E: 000001.231032 9 01 01 00 ff ef ff 00 00 00
# ReportID: 1 / Button: 1 0 0 0 0 | # | X: 0 | Y: -256
# | Wheel: -1 | AC Pan: 0 | 0x10168: 0
E: 000001.268584 9 01 01 00 00 f0 ff 00 00 00
Now i'm no computer scientist, but via bthidhub the x and y coordinates seem to be multiples of 256, which I think must mean that the x and y bytes are 8-bits out of alignment .
So how do I fix that?
So, I see in the first one:
E: 000000.163695 8 01 00 00 f0 ff 00 00 00
And, in the second one:
E: 000001.028618 9 01 01 00 00 f0 ff 00 00 00
Appears there is an extra 0x01 being added. Have you updated the mouse filter code as I mentioned? Maybe try printing out the msg going through that function to confirm exactly what is happening.
This is a great project . I have been looking for something like this for ages.
But it looks like my mouse sends data in a funny format which doesn't fit the standard mouse filter. The output from hid-tools says:
I thought i could maybe make an appropriate filter by adjusting the mx510 filter.
My interpretation of the hid-tools output is that we have
5bits for buttons + 3 bits padding 12 bits for x (-+2047) 12 bits for y (-+2047) 8 bits for wheel (-+127) 8 bits for ac pan (-+127) 8 bits for Vendor Usage 0x168 (-+127)
am I right?
if so, how do I turn that into a filter?
any help would be appreciated