Page 1 of 1
hi! (Yet Another Keyboard Question)
Posted: Mon Jan 12, 2004 12:44 pm
by Adek336
Could you tell me what's wrong with my code to select scancode set II:
Code: Select all
outportb(0x60, 0xf0);
outportb(0x60, 2);
Cheers,
Re:hi!
Posted: Mon Jan 12, 2004 12:49 pm
by Pype.Clicker
i'm unsure about why you try to change the scancode set, but as far as i remember, only the XT scancode is visible to the system programmer (unless you also disable any-to-XT conversion at the 8042)
you might wish to refer to
http://www.mega-tokyo.com/forum/index.p ... 06;start=0
Re:hi!
Posted: Mon Jan 12, 2004 1:20 pm
by Adek336
yea, now it works ;D I heard Linux uses set 2 or set 3, perhaps there is a difference?
Cheers,
Re:hi!
Posted: Mon Jan 12, 2004 1:30 pm
by Adek336
is it possible to disable autorepeat for all keys. I wonder how would Linux offer 100 chars/sec if one wouldn't
Cheers,
Adrian
Re:hi!
Posted: Mon Jan 12, 2004 3:54 pm
by Pype.Clicker
you can reprogram the so-called "typematic rate" by sending commands to the keyboard controller. I guess there must be one rate that says "no repeat", but i'm no longer sure ...
f3h: Typematic rate programming
Send a second byte with:
bit 0 -> 4: rate. Timings:
0: 30 keys/sec 10: 10
1: 26.7 13: 9
2: 24 16: 7.5
4: 20 20: 5
8: 15 31: 2
bit 5 & 6: pause before repeat:
0: 250 ms
1: 500
2: 750
4: 1000
bit 7: Always 0
hmm ... seems it's not so easy, so what you can do is:
- ignore new "make" codes until you received a "break" code (this means no longer auto-repeat)
- prepare a timer for Xms when a "make" code is received and repeat the last pressed key by software every Xms until a "break" code is received.
Re:hi!
Posted: Mon Jan 12, 2004 4:39 pm
by Adek336
Pype.Clicker: yea, that sounds reasonable.. I'll take a look at it as soon as I get the basic functions up and running.. it works quite well already
got it to check if set 3's supported by the kboard and then choose between set 2 and 3. As I see on my box, pressing one key then pressing another without leaving the first one, continues input with the second.. so it seems easy to have it on timers.
I wonder one more thing, how should I treat non-ascii chars. For example F1, should I do it the DOS way -> 0 + some other char.
Cheers,
Adrian
Re:hi!
Posted: Thu Jan 15, 2004 6:04 am
by Perica
..
Re:hi! (Yet Another Keyboard Question)
Posted: Thu Jan 15, 2004 7:17 am
by Pype.Clicker
@perica: did you also send the "do not convert scancodes" command to the '8042' ? the scancode set usually apply only between the keyboard and the controller and the controller translates what it receives in ol' good XT scancodes ...
As i don't know what USB is expected to do, it can indeed be the reason why your USB-8042 emulator chip doesn't emulate other scancodes even if the code would work on real PS/2 keyboard.
Re:hi! (Yet Another Keyboard Question)
Posted: Thu Jan 15, 2004 3:29 pm
by Adek336
my laptot does not seem to support either set 2 or 3 ??? The solution I found, is check for keyboard type (func 0xf2). If the return is not 0x83ab I suppose set 1 and install a set 1 handler. But if it is a 0x83ab, I install the set2/3 handler and I tell the kbd to choose set 3. Next, I read the set selected. I compare whether it's 2 or 3 and use the appropriate key mappings.
This is weird anyways, it should support at least set 2
Cheers,
Adrian