Same problem as for the ADB keyboards but for the USB ones ;)
Detection is based on keyboard models found in Apple laptops since the
powerbooks. While here correct the HID bluetooth usb product id.
Ok?
Martin
Index: ukbd.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.56
diff -u -p -r1.56 ukbd.c
--- ukbd.c 4 Dec 2011 15:09:35 -0000 1.56
+++ ukbd.c 26 Dec 2011 17:45:34 -0000
@@ -185,6 +185,7 @@ struct ukbd_translation {
void ukbd_gdium_munge(void *, uint8_t *, u_int);
#endif
void ukbd_apple_munge(void *, uint8_t *, u_int);
+void ukbd_apple_iso_munge(void *, uint8_t *, u_int);
uint8_t ukbd_translate(const struct ukbd_translation *, size_t,
uint8_t);
int
@@ -231,10 +232,20 @@ ukbd_attach(struct device *parent, struc
return;
if (uha->uaa->vendor == USB_VENDOR_APPLE) {
+ int iso = 0;
+
+ if ((uha->uaa->product == USB_PRODUCT_APPLE_FOUNTAIN_ISO) ||
+ (uha->uaa->product == USB_PRODUCT_APPLE_GEYSER_ISO))
+ iso = 1;
+
if (hid_locate(desc, dlen, HID_USAGE2(HUP_APPLE, HUG_FN_KEY),
uha->reportid, hid_input, &sc->sc_apple_fn, &qflags)) {
- if (qflags & HIO_VARIABLE)
- sc->sc_munge = ukbd_apple_munge;
+ if (qflags & HIO_VARIABLE) {
+ if (iso)
+ sc->sc_munge = ukbd_apple_iso_munge;
+ else
+ sc->sc_munge = ukbd_apple_munge;
+ }
}
}
@@ -498,6 +509,31 @@ ukbd_apple_munge(void *vsc, uint8_t *ibu
if (xlat != 0)
*pos = xlat;
}
+}
+
+void
+ukbd_apple_iso_munge(void *vsc, uint8_t *ibuf, u_int ilen)
+{
+ struct ukbd_softc *sc = vsc;
+ struct hidkbd *kbd = &sc->sc_kbd;
+ uint8_t *pos, *spos, *epos, xlat;
+
+ static const struct ukbd_translation apple_iso_trans[] = {
+ { 53, 100 }, /* less -> grave */
+ { 100, 53 },
+ };
+
+ spos = ibuf + kbd->sc_keycodeloc.pos / 8;
+ epos = spos + kbd->sc_nkeycode;
+
+ for (pos = spos; pos != epos; pos++) {
+ xlat = ukbd_translate(apple_iso_trans,
+ nitems(apple_iso_trans), *pos);
+ if (xlat != 0)
+ *pos = xlat;
+ }
+
+ ukbd_apple_munge(vsc, ibuf, ilen);
}
#ifdef __loongson__
Index: usbdevs
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.567
diff -u -p -r1.567 usbdevs
--- usbdevs 1 Dec 2011 22:49:26 -0000 1.567
+++ usbdevs 26 Dec 2011 17:43:25 -0000
@@ -878,8 +878,12 @@ product ANYDATA ADU_500A 0x6502 ADU-500A
product AOX USB101 0x0008 Ethernet
/* Apple Computer products */
+product APPLE FOUNTAIN_ANSI 0x020e Keyboard/Trackpad
+product APPLE FOUNTAIN_ISO 0x020f Keyboard/Trackpad
+product APPLE GEYSER_ANSI 0x0214 Keyboard/Trackpad
+product APPLE GEYSER_ISO 0x0215 Keyboard/Trackpad
product APPLE OPTMOUSE 0x0302 Optical mouse
-product APPLE ADB 0x1000 ADB device
+product APPLE BLUETOOTH_HCI 0x1000 HID-proxy
product APPLE SPEAKERS 0x1101 Speakers
product APPLE IPHONE 0x1290 iPhone
product APPLE IPOD_TOUCH 0x1291 iPod Touch