View previous topic :: View next topic |
Author |
Message |
Ringo42
Joined: 07 May 2004 Posts: 263
|
USb keyboard |
Posted: Wed Sep 13, 2006 8:25 am |
|
|
I'm using the usb dev kit and in it there is an example of sending keyboard data. is there a chart somewhere that shows the codes for all the keyboard keys (and then some)? Specificially I need to be able to send F18-F24.
Thanks
Ringo _________________ Ringo Davis |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Wed Sep 13, 2006 9:06 am |
|
|
Just google keyboard and scancode. You will get several links to look at. |
|
|
Ringo42
Joined: 07 May 2004 Posts: 263
|
|
Posted: Wed Sep 13, 2006 9:35 am |
|
|
Thanks, Scancode was the keyword I was missing. _________________ Ringo Davis |
|
|
Ringo42
Joined: 07 May 2004 Posts: 263
|
|
Posted: Wed Sep 20, 2006 1:05 pm |
|
|
I have the scancodes, but some appear to not work. For example Volume up is scancode 128 and vol down is 129. I'm using the usb dev kit and the mouse/kb example. I change the code where instead of sending an 'a' to teh computer it sends a vol down, but nothing happens. If I push the vol down button on my real keyboard then I see the volume slider move.
Here is the code snippet.
Code: |
void usb_keyboard_task(void) {
static int8 tx_msg[7]={0,0,0,0,0,0,0};
static int8 leds;
//F18=109
//F19=110 etc
//F24 = 115
if (!input(BUTTON))
{
// tx_msg[2]=5;//b
tx_msg[2]=129;// vol down
tx_msg[3]=0;
tx_msg[4]=0;
}
else
{
tx_msg[2]=0;
tx_msg[3]=0;
tx_msg[4]=0;
}
usb_put_packet(2,tx_msg,sizeof(tx_msg),USB_DTS_TOGGLE);
//receive NUM LOCK, CAPS LOCK, etc LED status from PC.
//we won't do anything with it.
if (usb_kbhit(2)) {
usb_get_packet(2, &leds, 1);
}
} |
any ideas? What am I missing here? _________________ Ringo Davis |
|
|
Ringo42
Joined: 07 May 2004 Posts: 263
|
|
Posted: Wed Sep 20, 2006 1:28 pm |
|
|
along the same lines, how do you send a capital letter?
I tried
tx_msg[0]=225;// shift
tx_msg[2]=29;// z
to send a big Z but all I get is a little z.
Thanks
Ringo _________________ Ringo Davis |
|
|
Ringo42
Joined: 07 May 2004 Posts: 263
|
|
Posted: Fri Sep 22, 2006 11:50 am |
|
|
I figured out a little bit. If I change the following lines in usb_desc_kb.h Then I can get some of the higher scancodes to work, but they still stop working around 127.
// 0x25, 0x65, //logical max (101) //104, 105
0x25, 0x81, //logical max (129) //104, 105
// 0x29, 0x65, //usage max (101) //110, 111
0x29, 0x81, //usage max (129) //110, 111
Of course 2 of the main keys I need are 128 and 129 (Volume up and down).
Has anyone tried this before?
Ringo _________________ Ringo Davis |
|
|
|