mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-02-12 02:27:09 +00:00
Added reporting of both USB and PS2 scancodes
This commit is contained in:
27
menu.c
27
menu.c
@@ -1045,36 +1045,27 @@ void HandleUI(void)
|
||||
OsdSetTitle("Keyboard", 0);
|
||||
menustate = MENU_8BIT_KEYTEST2;
|
||||
parentstate=MENU_8BIT_KEYTEST1;
|
||||
OsdKeyboardPressed(keys);
|
||||
OsdKeyboardModifiers(c);
|
||||
//strcpy(usb_id,"00000000");
|
||||
//siprintbinary(usb_id, sizeof(c), &c);
|
||||
OsdKeyboardPressed(keys, 0);
|
||||
OsdWrite(0, "", 0, 0);
|
||||
OsdWrite(1, " USB scancodes", 0, 0);
|
||||
siprintf(s, " %2x %2x %2x %2x %2x %2x", keys[0], keys[1], keys[2], keys[3], keys[4], keys[5]);
|
||||
OsdWrite(2, s, 0,0);
|
||||
OsdWrite(3, "", 0, 0);
|
||||
/*
|
||||
OsdWrite(4, " USB modifiers", 0, 0);
|
||||
siprintf(s, " %x", c);
|
||||
OsdWrite(5, s, 0, 0);
|
||||
*/
|
||||
OsdWrite(4, " ", 0, 0);
|
||||
OsdWrite(5, " ", 0, 0);
|
||||
OsdKeyboardPressed(keys, 1);
|
||||
siprintf(s, " %2x %2x %2x %2x %2x %2x", keys[0], keys[1], keys[2], keys[3], keys[4], keys[5]);
|
||||
OsdWrite(4, " PS/2 scancodes", 0, 0);
|
||||
OsdWrite(5, s, 0, 0);
|
||||
OsdWrite(6, " ", 0, 0);
|
||||
OsdWrite(7, STD_SPACE_EXIT, menusub==0, 0);
|
||||
break;
|
||||
|
||||
case MENU_8BIT_KEYTEST2:
|
||||
OsdKeyboardPressed(keys);
|
||||
OsdKeyboardPressed(keys, 0);
|
||||
siprintf(s, " %2x %2x %2x %2x %2x %2x", keys[0], keys[1], keys[2], keys[3], keys[4], keys[5]);
|
||||
OsdWrite(2, s, 0,0);
|
||||
OsdKeyboardModifiers(c);
|
||||
//strcpy(usb_id,"00000000");
|
||||
//siprintbinary(usb_id, sizeof(c), &c);
|
||||
/*
|
||||
siprintf(s, " %x", c);
|
||||
OsdWrite(5, s, 0, 0);*/
|
||||
OsdKeyboardPressed(keys, 1);
|
||||
siprintf(s, " %2x %2x %2x %2x %2x %2x", keys[0], keys[1], keys[2], keys[3], keys[4], keys[5]);
|
||||
OsdWrite(5, s, 0, 0);
|
||||
// allow allow exit when hitting space
|
||||
if(c==KEY_SPACE) {
|
||||
menustate = MENU_8BIT_CONTROLLERS1;
|
||||
|
||||
21
osd.c
21
osd.c
@@ -44,7 +44,6 @@ This is the Minimig OSD (on-screen-display) handler.
|
||||
#include "user_io.h"
|
||||
|
||||
|
||||
|
||||
// conversion table of Amiga keyboard scan codes to ASCII codes
|
||||
const char keycode_table[128] =
|
||||
{
|
||||
@@ -823,25 +822,29 @@ unsigned int OsdUsbPidGetB() {
|
||||
/* keyboard data */
|
||||
static unsigned char key_modifier = 0;
|
||||
static unsigned char key_pressed[6] = { 0,0,0,0,0,0 };
|
||||
void OsdKeyboardSet( unsigned char modifier, char* keycodes) {
|
||||
static unsigned char key_ps2[6] = { 0,0,0,0,0,0 };
|
||||
void OsdKeyboardSet( unsigned char modifier, char* keycodes, char* keycodes_ps2) {
|
||||
unsigned i=0;
|
||||
key_modifier = modifier;
|
||||
for(i=0; i<6; i++) {
|
||||
if((keycodes[i]&0xFF) != 0xFF )
|
||||
if((keycodes[i]&0xFF) != 0xFF ) {
|
||||
key_pressed[i]=keycodes[i];
|
||||
else
|
||||
key_ps2[i]=keycodes_ps2[i];
|
||||
if(key_ps2[i]==0xFF) key_ps2[i]=0;
|
||||
}
|
||||
else {
|
||||
key_pressed[i]=0;
|
||||
}
|
||||
iprintf("keyodes: %x %x\n", key_pressed[0], key_pressed[1]);
|
||||
|
||||
key_ps2[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
unsigned char OsdKeyboardModifiers() {
|
||||
return key_modifier;
|
||||
}
|
||||
void OsdKeyboardPressed(char *keycodes) {
|
||||
void OsdKeyboardPressed(char *keycodes, unsigned short as_ps2) {
|
||||
unsigned i=0;
|
||||
for(i=0; i<6; i++)
|
||||
keycodes[i]=key_pressed[i];
|
||||
keycodes[i]= as_ps2 ? key_ps2[i] : key_pressed[i];
|
||||
}
|
||||
|
||||
/* core currently loaded */
|
||||
|
||||
4
osd.h
4
osd.h
@@ -169,9 +169,9 @@ unsigned int OsdUsbVidGetB();
|
||||
unsigned int OsdUsbPidGetB();
|
||||
|
||||
// keyboard status
|
||||
void OsdKeyboardSet( unsigned char modifier, char* pressed);
|
||||
void OsdKeyboardSet( unsigned char modifier, char* pressed, char* pressed_ps2); //get usb and ps2 codes
|
||||
unsigned char OsdKeyboardModifiers();
|
||||
void OsdKeyboardPressed(char *pressed);
|
||||
void OsdKeyboardPressed(char *pressed, unsigned short as_ps2);
|
||||
|
||||
// get/set core currently loaded
|
||||
void OsdCoreNameSet(const char* str);
|
||||
|
||||
13
user_io.c
13
user_io.c
@@ -1436,6 +1436,7 @@ void user_io_kbd(unsigned char m, unsigned char *k, uint8_t priority) {
|
||||
|
||||
static unsigned char modifier = 0, pressed[6] = { 0,0,0,0,0,0 };
|
||||
char keycodes[6] = { 0,0,0,0,0,0 };
|
||||
char keycodes_ps2[6] = { 0,0,0,0,0,0 };
|
||||
char i, j;
|
||||
|
||||
// remap keycodes if requested
|
||||
@@ -1643,12 +1644,12 @@ void user_io_kbd(unsigned char m, unsigned char *k, uint8_t priority) {
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<6;i++) {
|
||||
pressed[i] = k[i];
|
||||
keycodes[i] = pressed[i]; // send raw USB code, not amiga - keycode(pressed[i]);
|
||||
}
|
||||
OsdKeyboardSet(m, keycodes);
|
||||
|
||||
for(i=0;i<6;i++) {
|
||||
pressed[i] = k[i];
|
||||
keycodes[i] = pressed[i]; // send raw USB code, not amiga - keycode(pressed[i]);
|
||||
keycodes_ps2[i] = usb2ps2[pressed[i]];
|
||||
}
|
||||
OsdKeyboardSet(m, keycodes, keycodes_ps2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user