hi! (Yet Another Keyboard Question)

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Adek336

hi! (Yet Another Keyboard Question)

Post 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,
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:hi!

Post 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
Adek336

Re:hi!

Post by Adek336 »

yea, now it works ;D I heard Linux uses set 2 or set 3, perhaps there is a difference?

Cheers,
Adek336

Re:hi!

Post by Adek336 »

is it possible to disable autorepeat for all keys. I wonder how would Linux offer 100 chars/sec if one wouldn't :o

Cheers,
Adrian
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:hi!

Post 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.
Adek336

Re:hi!

Post 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
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:hi!

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 11:04 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:hi! (Yet Another Keyboard Question)

Post 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.
Adek336

Re:hi! (Yet Another Keyboard Question)

Post 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 :o

Cheers,
Adrian
Post Reply