Page 1 of 2

HID Keyboard functionality?

Posted: Wed May 07, 2014 1:45 pm
by SnakeNuts
Hi all,

I've seen (and played around) with the HID mouse emulation in the pyb class, which is awesome!

However, I' was wondering if there is (or will be) any keyboard-emulation support? I've got some nifty ideas if that's possible.

Cheers,

Alex.

Re: HID Keyboard functionality?

Posted: Wed May 07, 2014 10:17 pm
by Mr.Nordheim
Have not tested any of the hid yet, but I got the urge as well for keyboard emulating.

Re: HID Keyboard functionality?

Posted: Fri Sep 05, 2014 8:57 pm
by CRImier
I second that. It'd be great for those numerous keyboard emulation projects =)

Re: HID Keyboard functionality?

Posted: Mon Sep 08, 2014 7:24 am
by torwag
Hi,

count me in, in fact you might want to read my rants about a DIY keyboard based on micropython

http://forum.micropython.org/viewtopic.php?f=5&t=284

I didn't find time to check into detail, but it shouldn't be to difficult to get something working taken that HID/mouse is there already

Re: HID Keyboard functionality?

Posted: Tue Sep 30, 2014 6:51 pm
by zs6mdh
Is anyone working on this yet? I dont want to do duplicate work if possible. I'll strt and if I do get anywhere I'll post some code or work out how to submit to git.

Re: HID Keyboard functionality?

Posted: Mon Oct 27, 2014 5:15 pm
by zs6mdh
Ive got plenty to learn before I get this right. This is way more difficult than I originally thought.

Re: HID Keyboard functionality?

Posted: Mon Oct 27, 2014 10:01 pm
by Damien
There have been a few requests now for extended HID functionality, so I'll start to look into it.

The idea would be that on boot up you specify "custom HID" and pass the HID descriptor, eg:

Code: Select all

descr = b"\x01\x02\x03..."
pyb.usb_mode('HID', descr)
Of course, the descr set of bytes will need to define a valid HID device, such as a keyboard or mouse.

Re: HID Keyboard functionality?

Posted: Sat Nov 01, 2014 9:51 pm
by Damien
I have made a pull request for custom HID functionality, including keyboard and mouse:

https://github.com/micropython/micropython/pull/955

Re: HID Keyboard functionality?

Posted: Thu Mar 19, 2015 6:23 pm
by philba2849
Is this part of the base image now? I just got a pyboard and my boot.py still shows the old format

import pyb
#pyb.main('main.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse

If not a standard part of the pyboard image, how would I go about adding it. I need a keyboard functionality for a project I'm working on.

Thanks

Re: HID Keyboard functionality?

Posted: Fri Mar 20, 2015 11:47 am
by Damien
philba2849 wrote:Is this part of the base image now? I just got a pyboard and my boot.py still shows the old format
It's part of the main image but no boards have yet shipped with this image because it still requires some final testing.

You can download the latest version from https://micropython.org/download/, anything later than v1.3.10 from 13th Feb 2015, eg pybv10-2015-03-20-v1.3.10-227-g3425431.dfu will have it enabled. Links on that page tell you how to program the new image; also search on this forum for "dfu" if you get stuck.

The boot.py can remain the same to get the old USB+MSC behaviour. New behaviour is not well documented, but see https://github.com/micropython/micropython/pull/955.