Lines 201-206
struct wmt_softc
Link Here
|
201 |
uint32_t caps; |
201 |
uint32_t caps; |
202 |
uint32_t isize; |
202 |
uint32_t isize; |
203 |
uint32_t nconts_max; |
203 |
uint32_t nconts_max; |
|
|
204 |
uint32_t report_len; |
204 |
uint8_t report_id; |
205 |
uint8_t report_id; |
205 |
|
206 |
|
206 |
struct hid_location cont_max_loc; |
207 |
struct hid_location cont_max_loc; |
Lines 251-257
static const struct usb_config wmt_config[WMT_N_TRANSFER] = {
Link Here
|
251 |
.endpoint = UE_ADDR_ANY, |
252 |
.endpoint = UE_ADDR_ANY, |
252 |
.direction = UE_DIR_IN, |
253 |
.direction = UE_DIR_IN, |
253 |
.flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, |
254 |
.flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, |
254 |
.bufsize = 0, /* use wMaxPacketSize */ |
255 |
.bufsize = WMT_BSIZE, |
255 |
.callback = &wmt_intr_callback, |
256 |
.callback = &wmt_intr_callback, |
256 |
}, |
257 |
}, |
257 |
}; |
258 |
}; |
Lines 492-501
wmt_intr_callback(struct usb_xfer *xfer, usb_error_t error)
Link Here
|
492 |
|
493 |
|
493 |
DPRINTFN(6, "sc=%p actlen=%d\n", sc, len); |
494 |
DPRINTFN(6, "sc=%p actlen=%d\n", sc, len); |
494 |
|
495 |
|
495 |
if (len >= (int)sc->isize || (len > 0 && sc->report_id != 0)) { |
496 |
if (len >= (int)sc->report_len || |
|
|
497 |
(len > 0 && sc->report_id != 0)) { |
496 |
/* Limit report length to the maximum */ |
498 |
/* Limit report length to the maximum */ |
497 |
if (len > (int)sc->isize) |
499 |
if (len > (int)sc->report_len) |
498 |
len = sc->isize; |
500 |
len = sc->report_len; |
499 |
|
501 |
|
500 |
usbd_copy_out(pc, 0, buf, len); |
502 |
usbd_copy_out(pc, 0, buf, len); |
501 |
|
503 |
|
Lines 504-511
wmt_intr_callback(struct usb_xfer *xfer, usb_error_t error)
Link Here
|
504 |
goto tr_ignore; |
506 |
goto tr_ignore; |
505 |
|
507 |
|
506 |
/* Make sure we don't process old data */ |
508 |
/* Make sure we don't process old data */ |
507 |
if (len < sc->isize) |
509 |
if (len < sc->report_len) |
508 |
bzero(buf + len, sc->isize - len); |
510 |
bzero(buf + len, sc->report_len - len); |
509 |
|
511 |
|
510 |
/* Strip leading "report ID" byte */ |
512 |
/* Strip leading "report ID" byte */ |
511 |
if (sc->report_id) { |
513 |
if (sc->report_id) { |
Lines 521-527
wmt_intr_callback(struct usb_xfer *xfer, usb_error_t error)
Link Here
|
521 |
|
523 |
|
522 |
case USB_ST_SETUP: |
524 |
case USB_ST_SETUP: |
523 |
tr_setup: |
525 |
tr_setup: |
524 |
usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); |
526 |
usbd_xfer_set_frame_len(xfer, 0, sc->isize); |
525 |
usbd_transfer_submit(xfer); |
527 |
usbd_transfer_submit(xfer); |
526 |
break; |
528 |
break; |
527 |
default: |
529 |
default: |
Lines 807-813
wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len)
Link Here
|
807 |
sc->ai[WMT_ORIENTATION].max = 1; |
809 |
sc->ai[WMT_ORIENTATION].max = 1; |
808 |
} |
810 |
} |
809 |
|
811 |
|
810 |
sc->isize = wmt_hid_report_size(d_ptr, d_len, hid_input, report_id); |
812 |
sc->isize = hid_report_size(d_ptr, d_len, hid_input, NULL); |
|
|
813 |
sc->report_len = wmt_hid_report_size(d_ptr, d_len, hid_input, |
814 |
report_id); |
811 |
sc->cont_max_rlen = wmt_hid_report_size(d_ptr, d_len, hid_feature, |
815 |
sc->cont_max_rlen = wmt_hid_report_size(d_ptr, d_len, hid_feature, |
812 |
cont_max_rid); |
816 |
cont_max_rid); |
813 |
if (thqa_cert_rid > 0) |
817 |
if (thqa_cert_rid > 0) |