Multiple Usb HID interface

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
pagano.paganino
Posts: 89
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Multiple Usb HID interface

Post by pagano.paganino » Mon Jan 25, 2021 11:03 am

Hi falks,
Is possibile to implement multiple usb hid interface? Kayboard + mouse

Thanks and regards,
F.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Multiple Usb HID interface

Post by jimmo » Tue Jan 26, 2021 12:56 am

pagano.paganino wrote:
Mon Jan 25, 2021 11:03 am
Is possibile to implement multiple usb hid interface? Kayboard + mouse
Unfortunately I don't think so... the pyb.usb_mode can only be given either hid=pyb.hid_keyboard or hid=pyb.hid_mouse.

This could probably be added though -- look in stm32/usb.c

STATIC mp_obj_t pyb_usb_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

pagano.paganino
Posts: 89
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Re: Multiple Usb HID interface

Post by pagano.paganino » Tue Jan 26, 2021 8:56 am

Reading the documentation https://www.usb.org/sites/default/files/hid1_11.pdf regarding the usb hid I found that it is possible to declare more reports but specifying a report id.

Can this feature be used in micropython?

the current implementation of the mouse and keyboard report ignore the report id (as per specification since it is only one report)
How complicated is it to implement this functionality?

https://github.com/micropython/micropyt ... hid.c#L340

https://github.com/micropython/micropyt ... id.c#L381

Thanks and regards,
F.

chuckbook
Posts: 135
Joined: Fri Oct 30, 2015 11:55 pm

Re: Multiple Usb HID interface

Post by chuckbook » Tue Jan 26, 2021 11:55 am

It can be done using an adequate HID descriptor.

pagano.paganino
Posts: 89
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Re: Multiple Usb HID interface

Post by pagano.paganino » Tue Jan 26, 2021 4:16 pm

chuckbook wrote:
Tue Jan 26, 2021 11:55 am
It can be done using an adequate HID descriptor.
Have you tried or are you assuming it works?

chuckbook
Posts: 135
Joined: Fri Oct 30, 2015 11:55 pm

Re: Multiple Usb HID interface

Post by chuckbook » Wed Jan 27, 2021 11:37 am

We are using it on PYBD SW6 to emulate a combination of TOUCH & KEYBOARD. It works perfect.

pagano.paganino
Posts: 89
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Re: Multiple Usb HID interface

Post by pagano.paganino » Thu Jan 28, 2021 10:32 am

Can you share an example of hid descriptor?

pagano.paganino
Posts: 89
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Re: Multiple Usb HID interface

Post by pagano.paganino » Mon Feb 08, 2021 9:34 am

chuckbook wrote:
Wed Jan 27, 2021 11:37 am
We are using it on PYBD SW6 to emulate a combination of TOUCH & KEYBOARD. It works perfect.
Can you share an example of hid descriptor and usage with send/recv?

Best regards,
F.

Post Reply