[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: switch from ADB to linux keycodes ...



> >> 1st press:    0x39
> >> 1st release:  0x80
> >> 2nd press:    0xb9
> >> 2nd release:  0x80
> 
> As noted previously, the PowerBook CapsLock generates:
> 
> 1st press:    0x39
> 1st release:  0xff
> 2nd press:    0xff
> 2nd release:  0xb9 
> 
> Note the difference in order of events for second press/release:
> 0xff/0xb9 versus 0xb9/0x80.  (Anyone know what other ADB keyboards
> do?)

Right, that makes it harder to handle. 

> m> :-) My ADB knowledge is a bit rusty - are there any other instances where
> m> a response packet byte has the highest bit set? Otherwise reply[0]&0x80
> m> would be a test to catch both.
> 
> 
>         I'm not sure I follow you but the highest bit normally
> distinguishes between a key "press" and a key "release":

That was it. Silly me. We need to ecplicitly test for 0x80 here. 
So in the Powerbook case we need a special hack (like toggle the last
pressed key state), in the other case we'd need to remember the last key
pressed, and fake a release event for that key if we see the 0x80. Can you
test what happens if you press another key and hold it down before
releasing capslock (or press and release another key before
releasing capslock). If that generates a 0x39 for the second capslock
press we can just remeber the last key pressed, otherwise we'll need to
keep track of capslock state. 

	Michael



Reply to: