Bug#239035: mac/ADB keymaps inappropriate for powerpc
On Tue, Mar 23, 2004 at 10:07:17AM +0000, Alastair McKinstry wrote:
> Looking at your patch, you removed mac_kbd.c from powerpc.
> I'd prefer to do the following: check in mac-kbd.c:
> 
>      fd = open("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes", O_RDONLY);
> 
>         if ((fd < 0) || (read(fd,&c, 1) != 1)) {
>                 di_info ("Failed to open /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes;
> Assuming not adb");
>                 k->present = FALSE;
>                 return keyboards;
>         }
>         close(fd);
>         if (c != '0') {
>                 di_info ("Sending linux keycodes ; not using ADB keymaps\n");
> 
>                 k->present = FALSE;
>                 return keyboards;
>         }
>                                                                            
>                                            
> 
> 
> This allows kbd-chooser to be used on a running system 
> as well as in d-i. Can you please verify this would work
> as planned on powerpc?
This approach *looks* correct to me, but I don't have a kernel with ADB
keycodes enabled, so I don't actually have a
keyboard_sends_linux_keycodes file in /proc.
However, it will clearly work in the powerpc d-i environment (er, famous
last words ...) because those kernels don't have ADB keycode support
either so kbd-chooser will take the first branch above.
> On review, it was a mistake to couple "architecture"
> (AT / USB / etc.) to keymap choice in d-i.
Yeah, I was thinking the same thing myself ...
> However fixing that  now in sarge would be too much breakage, so I am
> including your patch; and doing the following:
> 
> - Read the USB vendor code from /proc/bus/usb/devices ; 
> if the keyboard vendor != Apple, don't use the "USB" (Mac USB)
> keymaps. 
> - If in kbd-chooser.c we find no keyboards, and we're not using a
> serial console, use AT keymaps.
Sounds reasonable to me.
> Any comments ? Do you know of a way to detect ADB keyboards
> on 2.4 / 2.6 kernels?
  $ grep 'Name="ADB keyboard"' /proc/bus/input/devices
  N: Name="ADB keyboard"
That's one way on 2.6; I can't check 2.4 at the moment, though.
-- 
Colin Watson                                  [cjwatson@flatline.org.uk]
Reply to: