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

USB HID support #221

Closed
xavierzwirtz opened this issue Feb 6, 2014 · 15 comments
Closed

USB HID support #221

xavierzwirtz opened this issue Feb 6, 2014 · 15 comments

Comments

@xavierzwirtz
Copy link

Is it possible for the espruino to act as a USB keyboard, ala http://www.pjrc.com/teensy/td_keyboard.html ?

@gfwilliams
Copy link
Member

Not at the moment. It'd be nice if there was a way though.

It seems a lot of devices now enumerate as several different USB devices. Ideally Espruino could enumerate as CDC (the existing COM port), an HID keyboard + mouse, and possibly mass storage for accessing the SD card.

@gfwilliams
Copy link
Member

A thread on this here: http://forum.espruino.com/conversations/127079

Current thought is to allow a custom device IDs to be described along with handlers for each endpoint - that'd allow for keyboard/mouse/trackpad/joystick/etc.

Ideally that would be part of a commit that simplified USB though - currently there are 3 different copies of basically the same code (for F1/3 and 4 parts).

I'm not really that clued up on USB, so it'd be great if someone else could work on this.

@gfwilliams
Copy link
Member

Needed as it was a Pico KickStarter stretch goal that got hit

@gfwilliams
Copy link
Member

Other things required as part of this:

@gfwilliams
Copy link
Member

This is now added for the Pico as part of the NEW_USB Branch.

It's tantalisingly close for the Espruino Board too, but sadly not there yet - there seem to be some problems with how buffer sizes should be set for the USB hardware.

@zackp30
Copy link

zackp30 commented Aug 8, 2015

I'm about to get a Pico and just wanted to say thanks to all the contributors, especially to this issue. I wanted to make a password generator Yubikey-esque and the support for this is exactly what I needed. Thanks again!!!

@gfwilliams
Copy link
Member

Thanks! Just to add it's now all in the 1v80 release of the software, so I'm closing this.

It seems that Windows still has trouble picking Espruino Composite USB HID devices up, but they work great on Mac and Linux. Hopefully 1v81 will have the ability to disable the USB COM port and use only USB HID - which will make it work fine on Windows.

@zackp30
Copy link

zackp30 commented Aug 15, 2015

@gfwilliams I understand this is closed, but I'm just wondering if the Espruino Pico can be multiple HID devices at the same time, as in, a mouse and a keyboard?

@gfwilliams
Copy link
Member

As far as I know, it can't at the moment (although it might be possible for it to appear as one device that has a pointer and keys?). While you can specify a custom report descriptor, at the moment you can only send data to a single USB endpoint - and I think you may need 2 endpoints for 2 devices.

Maybe someone who is more clued up on USB would be able to help here?

It's a good point though. I've just filed an issue for adding 2 USB endpoints here: #562

@zackp30
Copy link

zackp30 commented Aug 17, 2015

Yeah after I had commented on here I tried using two descriptors in a single call to setUSBHid, it still detected one unfortuently, I researched a bit for Linux (because Windows has yet to work with the HID module) and found the usbhid kernel module had to be loaded in a certain way (a quirk option IIRC) but haven't got round to it due to me not having time.

I'll try and look into it soon!

@gfwilliams
Copy link
Member

Thanks! If you get it working, any info you have would be great.

It might be that the other descriptors just reference one report, like here.

Right now it'd need a recompile to change that, but it should be a lot easier when all the descriptors can be specified.

@opichals
Copy link
Contributor

opichals commented Mar 3, 2018

Ideally Espruino could enumerate as CDC (the existing COM port), an HID keyboard + mouse, and possibly mass storage for accessing the SD card.

Would be cool to be able to manipulate Storage module entries via USB Mass Storage.

@gfwilliams
Copy link
Member

I had been wondering about that kind of thing, but as I understand it Mass Storage exposes the underlying block device - so we'd have to move to a much bigger flash area and use FAT32 unless there's some crazy way we can fake a whole FAT32 filesystem.

The media transfer thing Android phones do when you plug them in might work though?

@opichals
Copy link
Contributor

opichals commented Mar 5, 2018

Well yes, it'd need to emulate some filesystem.

FAT16 perhaps?

@opichals
Copy link
Contributor

opichals commented Mar 5, 2018

But as you say, MTP could be the way to go. It's just that the USB Mass storage is easier from the user perspective.

The Teensy MTP responder implementation looks quite minimal.

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

No branches or pull requests

4 participants