-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Hid micro parser rc1 #1333
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
base: master
Are you sure you want to change the base?
Hid micro parser rc1 #1333
Conversation
Fix for 64bit test environment
Closed accidentally. |
fix build on 64bit compiler
Hopefully all the tests will pass now (I've build and tried them on a 64bit environment). |
Hihi, sorry for super late response, I have buried in work ever since the TET holiday. I will check this out as soon as I could |
No worries and thanks for running the builds. I think I can see what is causing the problems... I will make some changes get back to you. |
Should be ready for another run. [I'm developing on a Raspberry Pi and I'm not sure how to get rx-elf-gcc setup... so some of the builds may still be a bit hit and miss - sorry - and hope this is ok!] |
I tried to compile with rx-elf-gcc. Some errors were reported shown below. Of course, it is OK by adding two options C:/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c:52:46: error: unused parameter 'info' [-Werror=unused-parameter]
void handle_kbd_report(tusb_hid_host_info_t* info, const uint8_t* report, uint8_t report_length, uint8_t report_id)
~~~~~~~~~~~~~~~~~~~~~~^~~~
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c: In function 'handle_mouse_report':
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c:59:48: error: unused parameter 'info' [-Werror=unused-parameter]
void handle_mouse_report(tusb_hid_host_info_t* info, const uint8_t* report, uint8_t report_length, uint8_t report_id)
~~~~~~~~~~~~~~~~~~~~~~^~~~
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c: In function 'handle_gamepad_report':
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_app.c:86:50: error: unused parameter 'info' [-Werror=unused-parameter]
void handle_gamepad_report(tusb_hid_host_info_t* info, const uint8_t* report, uint8_t report_length, uint8_t report_id)
~~~~~~~~~~~~~~~~~~~~~~^~~~
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c: In function 'tuh_hid_joystick_process_axis':
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:131:11: error: unused parameter 'instance' [-Werror=unused-parameter]
uint8_t instance,
~~~~~~~~^~~~~~~~
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c: In function 'tuh_hid_joystick_process_usages':
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:154:39: error: format '%u' expects argument of type 'unsigned in
', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
printf("no usage - skipping bits %u \n", jdata->report_size * jdata->report_count);
~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%lu
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c: In function 'tusb_hid_print_simple_joysick_report':
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:266:61: error: format '%d' expects argument of type 'int', but argument 5 has type 'int32_t' {aka 'long int'} [-Werror=format=]
printf("dev_addr=%3d, instance=%3d, report_id=%3d, x1=%4d, y1=%4d, x2=%4d, y2=%4d, hat=%01X, buttons=%04X\n",
~~^
%4ld
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:270:7:
simple_joystick->values.x1,
~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c: In function 'tusb_hid_print_simple_joysick_report':
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:266:95: error: format '%X' expects argument of type 'unsigned in
', but argument 9 has type 'int32_t' {aka 'long int'} [-Werror=format=]
printf("dev_addr=%3d, instance=%3d, report_id=%3d, x1=%4d, y1=%4d, x2=%4d, y2=%4d, hat=%01X, buttons=%04X\n",
~~~^
%01lX
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:274:7:
simple_joystick->values.hat,
~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c: In function 'tusb_hid_print_simple_joysick_report':
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:266:109: error: format '%X' expects argument of type 'unsigned int', but argument 10 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
printf("dev_addr=%3d, instance=%3d, report_id=%3d, x1=%4d, y1=%4d, x2=%4d, y2=%4d, hat=%01X, buttons=%04X\n",
~~~^
%04lX
C:/tinyusb/examples/host/cdc_msc_hid/src/hid_host_joy.c:275:7:
simple_joystick->values.buttons);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Fix for Wall Werror
Many thanks both. I tweaked my compile settings to be fussier, which I think will get rid of the problems highlighted by kkitayam. I now get a nice clean run of
Ready for another try when you get time. |
Please don't run the build yet, I seem to be having some problems with the ceedling tests. |
Almost certain to work this time 🤔. Ready for another try... Thanks! |
Hid micro parser
For your consideration.
Introduces a micro HID report description parser and provides an example of its use by mapping HID joystick reports.
Combined with Ryzee119's mulit-hub modifications it works on an RP2040. Sorry, but it's not tested on any other architectures. On the RP2040, it works nicely with a hub hosting several joysticks.
I've tried to keep the existing tinyusb API the same but made some additions in hid_ri.h and hid_rip.h
The joystick demonstration is added to the the cdc_msc_hid example.
I have added a bunch of ceedling tests, including some for the new example code.
I've not worked on USB code before so sorry I have made mistakes or misinterpreted the spec. Most of code comes from a read through of hid1_11 spec.
I hope this helpful :-)
fruit-bat