5
« on: March 13, 2005, 06:29:25 am »
My reply is slightly OT as I have not tried oz on my 6000 yet. I believe the oz and sharp roms are similar enough that my comments may help.
There are two pieces to this puzzle, the kernel and the rom. The kernel has it's own key mapping but this is ignored by qt except for keycodes. Keycodes are mapped by the kernel and scancodes are mapped by qt. The kernel will associate a hardware key to a keycode, for example: 'A' is 1, 'B' is 2, etc. Then qt will associate a scancode with the keycode: 1 is 'a', shift 1 is 'A', fn 1 is '!', etc. This particular mapping is unique for the tosa (6000) keyboard and will vary by model.
Usb host functionality with hotplugging changes the keycode assignments assuming your usb keyboard is properly recognized. When a usb keyboard is attached, first hid.o is loaded and then usbkbd.o is loaded. Usbkbd changes the keycode mapping based on what is probably a standard us 101 keyboard. If you compare usb keyboards, especially the miniature ones, you'll see that keys are placed all over the place. This is one reason why some keys work, some keys don't work and some are wrong. Then you have to consider the qt scancode mappings. These do not change when you attach the usb keyboard. This is why the shift number keys are boogered.
The scancode problem is the easiest to fix. Just use keyhelper (I'm assuming there is a oz version in the feeds, correct me if I'm wrong). I think someone has posted a keyhelper config file in the 6000 hardware forum (look in the usb keyboards thread) which will get you started.
The keycode problem is a little more complicated. To fix this you will need the 6000 kernel source and a cross compiler. In usbkbd.c, you will find this section that changes the keycode mapping:
static unsigned char usb_kbd_keycode[256] = {
0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 28, 34, 31, 65, 92, 51, 52, 55,
54, 0, 97, 95, 96, 70, 98, 99,100, 60, 33, 58, 94, 39, 88, 89,
90,110,117,120, 30, 40,115, 0, 0, 0,104,106, 81,105,107, 124,
121,123,122, 32, 82, 83, 85, 86, 87, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,101, 69, 53, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56, 27, 57, 29,111,112,113,114, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
I'm using a model PSK-3100U mini keyboard which can be found on ebay as a "Traveller". I replaced the previous lines of code with this:
static unsigned char usb_kbd_keycode[256] = {
0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 28, 34, 31, 65, 92, 51, 52, 55,
54, 53, 97, 95, 96, 70, 98, 99,100, 60, 33, 58, 94, 39, 88, 89,
90,110,117,120, 30, 40,115, 0, 0, 82,104,106, 81,105,107, 124,
121,123,122, 32, 82, 83, 85, 86, 87, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,101, 69, 53, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56, 27, 57, 29,111,112,113,114, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
There are only a few changes here but enough to get my non-functioning keys working. Other models of keyboards will need to be customized as needed. You will need to go through the process of compiling a kernel but just do a "make modules" to create the usbkbd.o. Then copy the new module to your 6000.
Upon attaching the keyboard, I issue a "khctl reload" from the console. When I remove the keyboard, I issue "khctl disable". Without the "khctl disable", the key assignment on the built-in keyboard of the 6000 is screwed up.
So the short answer to your query is "Yes, but...".
What I would like to do next is automate the keyhelper part of this procedure. With hotplugging, there are places to tie these pieces together. Unfortunately, I have not been able to successfully send qcop messages from usbkbd.o or from scripts that are called by hotplugging. Any insight into this would be appreciated.
HTH,
Robert