Lines 158-163
struct ukbd_softc {
Link Here
|
158 |
struct hid_location sc_loc_numlock; |
158 |
struct hid_location sc_loc_numlock; |
159 |
struct hid_location sc_loc_capslock; |
159 |
struct hid_location sc_loc_capslock; |
160 |
struct hid_location sc_loc_scrolllock; |
160 |
struct hid_location sc_loc_scrolllock; |
|
|
161 |
struct hid_location sc_loc_consumer_ctl; |
161 |
struct usb_callout sc_callout; |
162 |
struct usb_callout sc_callout; |
162 |
struct ukbd_data sc_ndata; |
163 |
struct ukbd_data sc_ndata; |
163 |
struct ukbd_data sc_odata; |
164 |
struct ukbd_data sc_odata; |
Lines 187-193
struct ukbd_softc {
Link Here
|
187 |
#define UKBD_FLAG_ATTACHED 0x00000010 |
188 |
#define UKBD_FLAG_ATTACHED 0x00000010 |
188 |
#define UKBD_FLAG_GONE 0x00000020 |
189 |
#define UKBD_FLAG_GONE 0x00000020 |
189 |
|
190 |
|
190 |
#define UKBD_FLAG_HID_MASK 0x003fffc0 |
191 |
#define UKBD_FLAG_HID_MASK 0x007fffc0 |
191 |
#define UKBD_FLAG_APPLE_EJECT 0x00000040 |
192 |
#define UKBD_FLAG_APPLE_EJECT 0x00000040 |
192 |
#define UKBD_FLAG_APPLE_FN 0x00000080 |
193 |
#define UKBD_FLAG_APPLE_FN 0x00000080 |
193 |
#define UKBD_FLAG_APPLE_SWAP 0x00000100 |
194 |
#define UKBD_FLAG_APPLE_SWAP 0x00000100 |
Lines 203-208
struct ukbd_softc {
Link Here
|
203 |
#define UKBD_FLAG_NUMLOCK 0x00080000 |
204 |
#define UKBD_FLAG_NUMLOCK 0x00080000 |
204 |
#define UKBD_FLAG_CAPSLOCK 0x00100000 |
205 |
#define UKBD_FLAG_CAPSLOCK 0x00100000 |
205 |
#define UKBD_FLAG_SCROLLLOCK 0x00200000 |
206 |
#define UKBD_FLAG_SCROLLLOCK 0x00200000 |
|
|
207 |
#define UKBD_FLAG_CONSUMERCTL 0x00400000 |
206 |
|
208 |
|
207 |
int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ |
209 |
int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ |
208 |
int sc_state; /* shift/lock key state */ |
210 |
int sc_state; /* shift/lock key state */ |
Lines 234-239
struct ukbd_softc {
Link Here
|
234 |
uint8_t sc_id_capslock; |
236 |
uint8_t sc_id_capslock; |
235 |
uint8_t sc_id_scrolllock; |
237 |
uint8_t sc_id_scrolllock; |
236 |
uint8_t sc_id_events; |
238 |
uint8_t sc_id_events; |
|
|
239 |
uint8_t sc_id_consumer_ctl; |
237 |
uint8_t sc_kbd_id; |
240 |
uint8_t sc_kbd_id; |
238 |
|
241 |
|
239 |
uint8_t sc_buffer[UKBD_BUFFER_SIZE]; |
242 |
uint8_t sc_buffer[UKBD_BUFFER_SIZE]; |
Lines 834-839
ukbd_intr_callback(struct usb_xfer *xfer, usb_error_t error)
Link Here
|
834 |
} |
837 |
} |
835 |
} |
838 |
} |
836 |
|
839 |
|
|
|
840 |
if ((sc->sc_flags & UKBD_FLAG_CONSUMERCTL) && |
841 |
(id == sc->sc_id_consumer_ctl)) { |
842 |
i = sc->sc_loc_consumer_ctl.count; |
843 |
if (i > UKBD_NKEYCODE) |
844 |
i = UKBD_NKEYCODE; |
845 |
if (i > len) |
846 |
i = len; |
847 |
while (i--) { |
848 |
sc->sc_ndata.keycode[i] = hid_consumerctl_to_scancode( |
849 |
hid_get_data(sc->sc_buffer + i, len - i, |
850 |
&sc->sc_loc_consumer_ctl)); |
851 |
} |
852 |
} |
853 |
|
837 |
ukbd_interrupt(sc); |
854 |
ukbd_interrupt(sc); |
838 |
|
855 |
|
839 |
if (ukbd_any_key_pressed(sc) != 0) { |
856 |
if (ukbd_any_key_pressed(sc) != 0) { |
Lines 1198-1203
ukbd_parse_hid(struct ukbd_softc *sc, const uint8_t *ptr, uint32_t len)
Link Here
|
1198 |
sc->sc_flags |= UKBD_FLAG_SCROLLLOCK; |
1215 |
sc->sc_flags |= UKBD_FLAG_SCROLLLOCK; |
1199 |
DPRINTFN(1, "Found keyboard scrolllock\n"); |
1216 |
DPRINTFN(1, "Found keyboard scrolllock\n"); |
1200 |
} |
1217 |
} |
|
|
1218 |
|
1219 |
/* figure out consumer control (multimedia keys) on keyboard */ |
1220 |
if (hid_locate(ptr, len, |
1221 |
HID_USAGE2(HUP_CONSUMER, 0x01), |
1222 |
hid_input, 0, &sc->sc_loc_consumer_ctl, &flags, |
1223 |
&sc->sc_id_consumer_ctl)) { |
1224 |
sc->sc_flags |= UKBD_FLAG_CONSUMERCTL; |
1225 |
DPRINTFN(1, "Found keyboard consumer control\n"); |
1226 |
} |
1201 |
} |
1227 |
} |
1202 |
|
1228 |
|
1203 |
static int |
1229 |
static int |