-/* $OpenBSD: aplhidev.c,v 1.8 2022/10/02 19:00:46 kettenis Exp $ */
+/* $OpenBSD: aplhidev.c,v 1.9 2022/11/09 10:05:18 robert Exp $ */
/*
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2013-2014 joshua stein <jcs@openbsd.org>
#include <dev/ofw/ofw_gpio.h>
#include <dev/ofw/ofw_pinctrl.h>
+#include <dev/usb/usbdevs.h>
+
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wskbdvar.h>
#include <dev/wscons/wsksymdef.h>
printf("\n");
if (hid_locate(aa->aa_desc, aa->aa_desclen, HID_USAGE2(HUP_APPLE, HUG_FN_KEY),
- 1, hid_input, &kbd->sc_fn, NULL))
- kbd->sc_munge = hidkbd_apple_munge;
+ 1, hid_input, &kbd->sc_fn, NULL)) {
+ switch (sc->sc_hidev->sc_product) {
+ case USB_PRODUCT_APPLE_WELLSPRINGM1_J293:
+ kbd->sc_munge = hidkbd_apple_tb_munge;
+ break;
+ default:
+ kbd->sc_munge = hidkbd_apple_munge;
+ break;
+ }
+ }
if (kbd->sc_console_keyboard) {
extern struct wskbd_mapdata ukbd_keymapdata;
-/* $OpenBSD: hidkbd.c,v 1.7 2022/09/16 16:30:10 robert Exp $ */
+/* $OpenBSD: hidkbd.c,v 1.8 2022/11/09 10:05:18 robert Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
};
#endif /* defined(WSDISPLAY_COMPAT_RAWKBD) */
+static const struct hidkbd_translation apple_tb_trans[] = {
+ { 30, 58 }, /* 1 -> F1 */
+ { 31, 59 }, /* 2 -> F2 */
+ { 32, 60 }, /* 3 -> F3 */
+ { 33, 61 }, /* 4 -> F4 */
+ { 34, 62 }, /* 5 -> F5 */
+ { 35, 63 }, /* 6 -> F6 */
+ { 36, 64 }, /* 7 -> F7 */
+ { 37, 65 }, /* 8 -> F8 */
+ { 38, 66 }, /* 9 -> F9 */
+ { 39, 67 }, /* 0 -> F10 */
+ { 45, 68 }, /* - -> F11 */
+ { 46, 69 } /* = -> F12 */
+};
+
static const struct hidkbd_translation apple_fn_trans[] = {
{ 40, 73 }, /* return -> insert */
{ 42, 76 }, /* backspace -> delete */
nitems(apple_fn_trans));
}
+void
+hidkbd_apple_tb_munge(void *vsc, uint8_t *ibuf, u_int ilen)
+{
+ struct hidkbd *kbd = vsc;
+
+ if (!hid_get_data(ibuf, ilen, &kbd->sc_fn))
+ return;
+
+ hidkbd_apple_munge(vsc, ibuf, ilen);
+
+ hidkbd_apple_translate(vsc, ibuf, ilen, apple_tb_trans,
+ nitems(apple_tb_trans));
+}
+
void
hidkbd_apple_iso_munge(void *vsc, uint8_t *ibuf, u_int ilen)
{
-/* $OpenBSD: hidkbdsc.h,v 1.2 2022/09/16 16:30:10 robert Exp $ */
+/* $OpenBSD: hidkbdsc.h,v 1.3 2022/11/09 10:05:18 robert Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
int hidkbd_set_leds(struct hidkbd *, int, uint8_t *);
uint8_t hidkbd_translate(const struct hidkbd_translation *, size_t, uint8_t);
void hidkbd_apple_munge(void *, uint8_t *, u_int);
+void hidkbd_apple_tb_munge(void *, uint8_t *, u_int);
void hidkbd_apple_iso_munge(void *, uint8_t *, u_int);
void hidkbd_apple_mba_munge(void *, uint8_t *, u_int);
void hidkbd_apple_iso_mba_munge(void *, uint8_t *, u_int);