Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HID USB with 16bit deltas #366

Closed
perigoso opened this issue Apr 21, 2020 · 7 comments
Closed

HID USB with 16bit deltas #366

perigoso opened this issue Apr 21, 2020 · 7 comments

Comments

@perigoso
Copy link
Collaborator

Question Description
I implemented a usb device that advertises as an hid mouse, it is working great, but i wanted to make a small change, i want to send X & Y delta values in int16 variables, i believe this is possible, but i couldn't get it to work.

am i correct to assume:
I can just make an alternate version of TUD_HID_REPORT_DESC_MOUSE with

HID_LOGICAL_MIN_N ( 0x8000, 2                             ) ,\
HID_LOGICAL_MAX_N ( 0x7FFF, 2                           ) ,\
HID_REPORT_COUNT( 2                                  ) ,\
HID_REPORT_SIZE ( 16                                    ) ,\

and then a modified hid_mouse_report_t
and
tud_hid_report(REPORT_ID_MOUSE, &report, sizeof(report));

what am i missing? i tried it but it stopped enumerating. i didn't want to keep messing around, i'm sure it's straight forward.

@perigoso perigoso added the Q&A label Apr 21, 2020
@hathach
Copy link
Owner

hathach commented Apr 22, 2020

are you able to get any error message from host and/or check your descriptor with other hid parser tool ?

@perigoso
Copy link
Collaborator Author

the device does not show up on lsusb, i'm not sure how to debug usb devices, is there a log somewhere? I'm running linux (arch) btw.

@perigoso
Copy link
Collaborator Author

are there tools you recomend?

@hathach
Copy link
Owner

hathach commented Apr 25, 2020

failed to enumerate is probably other issue, are you running the stock hid example with only the hid descriptor as modification. For tool, you should buy an hardware usb analyzer, software analyzer is not trustworthy

@perigoso
Copy link
Collaborator Author

I was running the stock hid composite, it was working fine, those were the only modifications

@pigrew
Copy link
Collaborator

pigrew commented Apr 26, 2020

I just tried implementing this, and it seems to work for me. One note is that I had issues after making changes because the makefiles don't properly handle header file dependencies. I had to make clean and make again.

See my branch (which I'll probably delete once this issue is closed):

https://github.com/pigrew/tinyusb/tree/16_bit_mouse_hid

I'm using Windows 10.

@perigoso
Copy link
Collaborator Author

Got it working, the issue lied in that i included tinyusb as a submodule, so i had to keep changes only to my side of the code, when i declared the alternate report descriptor i had missing includes, probably causing a misconstrued report descriptor.

Thank you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants