Keyboard and Mouse HID

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
mbresciani
Posts: 5
Joined: Wed Sep 12, 2012 3:32 pm

Keyboard and Mouse HID

Post by mbresciani » Sun Dec 16, 2012 10:41 am

Hi,

I am having fun with my little LeoStick and have programmed a few of my own sketches successfully, but I keep getting verify errors whenever I try to use any Keyboard or Mouse HID functions.

Is it different from the Leonardo in that you have to include headers to use these functions?

I am using 'Arduino 1.0.1" and "Freetronics LeoStick V1.0" for the board selection.

Any help would be appreciated.

Thanks...

mbresciani
Posts: 5
Joined: Wed Sep 12, 2012 3:32 pm

Re: Keyboard and Mouse HID

Post by mbresciani » Sun Dec 16, 2012 10:12 pm

An example of a verification/compile error message is when when I load the 'KeyboardMessage' sketch located in the '09. USB (Leonardo)' examples section and press the 'verify' button' I get:

'class Keyboard_' has no member named 'begin'

KeyboardMessage.cpp: In function 'void setup()':
KeyboardMessage:28: error: 'class Keyboard_' has no member named 'begin'

I tried adding #include <KeyboardMessage.h> but it made no difference.

I don't get any errors when I compile any of the Leonardo examples when I select the Leonardo board (but obviously then I cant upload that to the LeoStick).

Can anyone point me in the right direction, I see that other people have been successful.

efry
Posts: 6
Joined: Tue May 29, 2012 12:10 am

Re: Keyboard and Mouse HID

Post by efry » Tue Dec 18, 2012 1:40 am

Hi,

I had the same problem. The leostick hardware profile is based on v1.0 NOT version 1.0.1. So it doesn't contain the additional keyboard handling functions like begin()

I ended up hacking the 1.0.1 keyboard changes into the leostick profile which allowed me to use the new keyboard methods.

It would be nice if the leostick hardware profile could be brought up to date with the current leonardo version.

Regards,
Eric

mbresciani
Posts: 5
Joined: Wed Sep 12, 2012 3:32 pm

Re: Keyboard and Mouse HID

Post by mbresciani » Wed Dec 19, 2012 2:14 am

Thank you for taking time to reply #tronixstuff, I do appreciate it.

Unfortunately I forgot to mention that I am using a Mac so I don't need the updated USB .inf file.

Like I said it is working normally when using RGB LED and Piezo Sound functions (etc), but the sketches just doesn't compile if they contain any HID functions.

I hope it is not because I have the 'Diskloader' bootloader version and that I have to go out and purchase more hardware so I can install the 'Caterina' bootloader.

Can anyone point me in the right direction, please?

mbresciani
Posts: 5
Joined: Wed Sep 12, 2012 3:32 pm

Re: Keyboard and Mouse HID

Post by mbresciani » Wed Dec 19, 2012 2:22 am

Hi #efry,

I just saw your reply, thanks for the info.

I don't suppose that you could post a quick and simple guide on exactly how you hacked the 1.0.1 keyboard changes into the LeoStick profile?

I think that it would help a lot of people like me. :D

efry
Posts: 6
Joined: Tue May 29, 2012 12:10 am

Re: Keyboard and Mouse HID

Post by efry » Wed Dec 19, 2012 12:09 pm

Hi,

The link mentioned by tronixstuff doesn't contain the correct keyboard handler code. I had to patch that in from the official ardiuino leonardo hardware profile.

Here's my modified version of

LeoStick/cores/arduino/HID.cpp

http://pastebin.com/9ZqnkCiq

and

LeoStick/cores/arduino/USBAPI.h

http://pastebin.com/Tp4NAS4Z

If you replace those files in your leostick hardware profile then you should be in business.

Regards,
Eric

mbresciani
Posts: 5
Joined: Wed Sep 12, 2012 3:32 pm

Re: Keyboard and Mouse HID

Post by mbresciani » Wed Dec 19, 2012 11:40 pm

Eureka it works!!!

Not only can I now use the HID functions, but I now understand how to patch hardware profiles. :D

Thanks #efry! We need more people like you on this forum.

bassdude
Posts: 1
Joined: Thu Mar 28, 2013 4:37 am

Re: Keyboard and Mouse HID

Post by bassdude » Fri Mar 29, 2013 5:47 am

Is there some central DB/repository within this forum where source & headers like below can be placed? Because these no longer exist in pastebin. Or special access is required which I don't have ...

Peter
efry wrote:Hi,

The link mentioned by tronixstuff doesn't contain the correct keyboard handler code. I had to patch that in from the official ardiuino leonardo hardware profile.

Here's my modified version of

LeoStick/cores/arduino/HID.cpp

http://pastebin.com/9ZqnkCiq

and

LeoStick/cores/arduino/USBAPI.h

http://pastebin.com/Tp4NAS4Z

If you replace those files in your leostick hardware profile then you should be in business.

Regards,
Eric

cef
Freetronics Staff
Freetronics Staff
Posts: 106
Joined: Wed Nov 09, 2011 12:53 am

Re: Keyboard and Mouse HID

Post by cef » Fri Mar 29, 2013 6:27 am

To stop spammers we've had to limit file uploads/attachments so that you have to post a certain number of posts before you can access those features.

Hopefully if efry or mbresciani see this, perhaps they can repost the updates files as attachments? Both of them have posted enough posts and should have the relevant files.

efry
Posts: 6
Joined: Tue May 29, 2012 12:10 am

Re: Keyboard and Mouse HID

Post by efry » Tue Apr 02, 2013 1:41 am

Hi,

You should be able to get the files from this link.
viewtopic.php?f=27&t=3876&sid=5baf33391 ... 91af#p7932

Regards,
Eric
cef wrote:To stop spammers we've had to limit file uploads/attachments so that you have to post a certain number of posts before you can access those features.

Hopefully if efry or mbresciani see this, perhaps they can repost the updates files as attachments? Both of them have posted enough posts and should have the relevant files.

Post Reply