Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: dublo7 on December 28, 2012, 08:40:58 pm
-
I'm having some troubles using the USB Keyboard example. It seems to be dropping characters. I've tried adding more "DigiKeyboard.update();" commands into the example, and manipulating the delay, but nothing seems to be working.
This is the output I tend to get - the initial H is missing.
Hello digispark
Hello digispark
Hello digispark
ello digispark
ello digispark
Hello digispark
Hello digispark
ello digispark
ello digispark
ello digispark
Does anyone have any tips to make things output be more reliable?
I've tried adding a delay after the update, before the first H but that hasn't worked. Not sure what else to try.
-
Hello digispark
Hello digispark
Hello digispark
Hello digispark
Hello digispark
Hello digispark
Hello digispark
Hello digispark
Hello digispark
Hello digispark
Hello digispark
with OS X 10.8.2, I did not see any issues with the demo program...
-
Mine is OSX 10.6.2... a 2009 Macbook Pro. Maybe it\'s just too old.
-
Appears to be a known bug - found this in the source of DigiKeyboard.h
// TODO: Remove the next two lines once we fix
// missing first keystroke bug properly.
memset(reportBuffer, 0, sizeof(reportBuffer));
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
-
I sometimes experience and issue on older machines with the first key not registering after a long pause - my work around for this (until I have time to chase issues like this - meaning after shipping is done) - is to send
DigiKeyboard.sendKeyStroke(0);
which is a keyboard event with no keystroke, to essentially wake things up after a delay, before sending more keystrokes - I only see this issue on one of my many test machines, and it is an old Atom based file server that runs the shipping program.
-
Thanks digistump, That fixed it for me. Maybe you could update the example program with that line and a comment so it just works out of the box.
The only issue now is OSX doing its identify this new keyboard thing every time I plug it in. Any idea of work arounds for that issue?
-
I\'ve added the line and a note to the newest release of the software package.
-
@dublo7 - I haven\'t played with the Macs, but could it be because OSX is seeing a VendorID (VID) and ProductID (PID) combination it hasn\'t seen before?
If so, maybe changing the USB VID and USB PID to match those of the regular apple keyboard would prevent the invocation? I believe they\'re just defined in usbconfig.h under the DigisparkKeyboard/ library. (Pay careful attention to the comments regarding the byte order.) I\'d experiment with that and see if it helps.
-
@kcbudd - Good Call, I found the following codes worked to make OSX not try to detect the keyboard.
05ac Apple, Inc.
0201 USB Keyboard [Alps or Logitech, M2452]
The actual lines of code I used in usbconfig.h were...
#define USB_CFG_VENDOR_ID 0xac, 0x05
#define USB_CFG_DEVICE_ID 0x01, 0x02
I left the vendor name alone so technically it\'s still reporting to be an apple keyboard with the vendor name digistump, but it will work for my purposes.
I used the list of USB vendor/product ids from the linux usb project.
http://www.linux-usb.org/usb.ids
Hopefully this helps someone in the future.
-
thanks for sharing that - that will definitely come in handy!