version 1.2, 2001/12/30 07:10:42 |
version 1.3, 2002/05/02 20:12:07 |
|
|
* report in the variable-sized data field. |
* report in the variable-sized data field. |
*/ |
*/ |
report->buffer = malloc(sizeof(*report->buffer) - |
report->buffer = malloc(sizeof(*report->buffer) - |
sizeof(report->buffer->data) + |
sizeof(report->buffer->ucr_data) + |
report->size); |
report->size); |
if (report->buffer == NULL) |
if (report->buffer == NULL) |
err(1, NULL); |
err(1, NULL); |
|
|
if (report->size == 0) |
if (report->size == 0) |
return; |
return; |
|
|
report->buffer->report = reptoparam[repindex].uhid_report; |
report->buffer->ucr_report = reptoparam[repindex].uhid_report; |
if (ioctl(hidfd, USB_GET_REPORT, report->buffer) < 0) |
if (ioctl(hidfd, USB_GET_REPORT, report->buffer) < 0) |
err(1, "USB_GET_REPORT"); |
err(1, "USB_GET_REPORT"); |
} |
} |
|
|
setreport(struct Sreport *report, int hidfd, int repindex) |
setreport(struct Sreport *report, int hidfd, int repindex) |
{ |
{ |
if (report->status == srs_dirty) { |
if (report->status == srs_dirty) { |
report->buffer->report = reptoparam[repindex].uhid_report; |
report->buffer->ucr_report = reptoparam[repindex].uhid_report; |
|
|
if (ioctl(hidfd, USB_SET_REPORT, report->buffer) < 0) |
if (ioctl(hidfd, USB_SET_REPORT, report->buffer) < 0) |
err(1, "USB_SET_REPORT(%s)", |
err(1, "USB_SET_REPORT(%s)", |
|
|
errx(1, "Input report descriptor invalid length"); |
errx(1, "Input report descriptor invalid length"); |
|
|
dlen = inreport.size; |
dlen = inreport.size; |
dbuf = inreport.buffer->data; |
dbuf = inreport.buffer->ucr_data; |
|
|
for (;;) { |
for (;;) { |
ssize_t readlen; |
ssize_t readlen; |
|
|
if (matchvar != NULL) |
if (matchvar != NULL) |
matchvar->opfunc(&hitem, matchvar, |
matchvar->opfunc(&hitem, matchvar, |
colls, collind, |
colls, collind, |
inreport.buffer->data); |
inreport.buffer->ucr_data); |
} |
} |
hid_end_parse(hdata); |
hid_end_parse(hdata); |
printf("\n"); |
printf("\n"); |
|
|
getreport(repptr, hidfd, rd, repindex); |
getreport(repptr, hidfd, rd, repindex); |
|
|
bufdata = (repptr == NULL || repptr->buffer == NULL) ? |
bufdata = (repptr == NULL || repptr->buffer == NULL) ? |
NULL : repptr->buffer->data; |
NULL : repptr->buffer->ucr_data; |
|
|
if (matchvar->opfunc(&hitem, matchvar, colls, collind, |
if (matchvar->opfunc(&hitem, matchvar, colls, collind, |
bufdata)) |
bufdata)) |