HID Keyboard functionality?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
SnakeNuts
Posts: 1
Joined: Wed May 07, 2014 10:46 am

HID Keyboard functionality?

Post by SnakeNuts » Wed May 07, 2014 1:45 pm

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.

Mr.Nordheim
Posts: 14
Joined: Wed May 07, 2014 7:32 pm
Location: Norway

Re: HID Keyboard functionality?

Post by Mr.Nordheim » Wed May 07, 2014 10:17 pm

Have not tested any of the hid yet, but I got the urge as well for keyboard emulating.

CRImier
Posts: 11
Joined: Fri Aug 01, 2014 10:40 pm
Location: Latvia
Contact:

Re: HID Keyboard functionality?

Post by CRImier » Fri Sep 05, 2014 8:57 pm

I second that. It'd be great for those numerous keyboard emulation projects =)

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: HID Keyboard functionality?

Post by torwag » Mon Sep 08, 2014 7:24 am

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

zs6mdh
Posts: 9
Joined: Fri Mar 07, 2014 4:58 am

Re: HID Keyboard functionality?

Post by zs6mdh » Tue Sep 30, 2014 6:51 pm

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.

zs6mdh
Posts: 9
Joined: Fri Mar 07, 2014 4:58 am

Re: HID Keyboard functionality?

Post by zs6mdh » Mon Oct 27, 2014 5:15 pm

Ive got plenty to learn before I get this right. This is way more difficult than I originally thought.

Damien
Site Admin
Posts: 635
Joined: Mon Dec 09, 2013 5:02 pm

Re: HID Keyboard functionality?

Post by Damien » Mon Oct 27, 2014 10:01 pm

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.

Damien
Site Admin
Posts: 635
Joined: Mon Dec 09, 2013 5:02 pm

Re: HID Keyboard functionality?

Post by Damien » Sat Nov 01, 2014 9:51 pm

I have made a pull request for custom HID functionality, including keyboard and mouse:

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

philba2849
Posts: 1
Joined: Thu Mar 19, 2015 6:13 pm

Re: HID Keyboard functionality?

Post by philba2849 » Thu Mar 19, 2015 6:23 pm

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

Damien
Site Admin
Posts: 635
Joined: Mon Dec 09, 2013 5:02 pm

Re: HID Keyboard functionality?

Post by Damien » Fri Mar 20, 2015 11:47 am

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.

Post Reply