espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.79k stars 747 forks source link

2 USB endpoints for HID #562

Open gfwilliams opened 9 years ago

gfwilliams commented 9 years ago

At some point we'll allow the full USB descriptor to be fully changed, which will sort out the HID problems on Windows (which doesn't seem to like enumerating the current composite HID+CDC devices).

However it's been suggested that it would be good to be able to support two HID devices (eg. mouse + keyboard), so it would be worth trying to arrange that two endpoints could be made available (maybe with a modification to the E.sendUSBHID command)

t3rminus commented 7 years ago

This sounds great! I know HID is pretty new, but I bought the pico to develop some custom HID stuff. Don't care as much about 2 endpoints, but being able to change the descriptor and receive data would be amazing.

gfwilliams commented 7 years ago

If it's just HID you care about then you can do custom descriptors at least - like is done for the USBKeyboard/etc modules: https://github.com/espruino/EspruinoDocs/blob/master/modules/USBKeyboard.js

But yes, we'd have to do wait for this issue to get solved before you can receive

t3rminus commented 7 years ago

Yep! Been doing that. I meant it would be nice to be able to change the Product/Manufacturer strings, as well.

bmatusiak commented 2 years ago

i know this is old.. i see there is E.sendUSBHID(data) . now we need E.readUSBHID

just looking for a status update if possible

something to have fun with


E.setUSBHID({
  reportDescriptor : [
    0x06, 0xd0,
    0xf1, 0x09,
    0x01, 0xa1,
    0x01, 0x09,
    0x20, 0x15,
    0x00, 0x26,
    0xff, 0x00,
    0x75, 0x08,
    0x95, 0x40,
    0x81, 0x02,
    0x09, 0x21,
    0x15, 0x00,
    0x26, 0xff,
    0x00, 0x75,
    0x08, 0x95,
    0x40, 0x91,
    0x02, 0xc0
  ]
});

var i = 0;
setInterval(function(){
  ++i;
  E.sendUSBHID([0,"a"]);
},100)
'''

'$ sudo cat /dev/hidraw0'
gfwilliams commented 2 years ago

For Bluetooth devices we have an NRF.HID event (http://www.espruino.com/Reference#l_NRF_HID) so something similar could be done with USB I guess.

However I'm afraid it's pretty low priority at the moment - which device were you looking at using this with?

bmatusiak commented 2 years ago

pinless pico usb ,

secondary, off topic. i also have a microsd->esp8266/atmega32u4->usb https://github.com/bmatusiak/CJMCU-3212-wifi_ducky i could use that and customize the 32u4 to proxy one of the serials classes via hid. but that be a bit more complicated for a end-user to flash. when i could just ask my buddy to run a script on a pico i do plan on getting the new wifi version when released so i got the pico for now to test out. just making sure it meets my requirements.

gfwilliams commented 2 years ago

Ok, thanks! Just to say the new WiFi almost certainly won't use STM32 (it'll be Nordic nRF52840). I'm not sure what the situation will be with USB HID support, but it'll definitely support 2 way HID via BLE out of the box