阅读:1797回复:0
这个两个结构体怎么存放我的数据
情况:控制一个USB HID类设备
发送命令给HID类设备 命令: Byte0: 0x02 (report_id) Byte1: 0x13 (command) 数据结构: /* This might be useful to know: To actually send a value to the device, perform a SUSAGE first, followed by a SREPORT. #define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) struct hiddev_usage_ref { unsigned report_type; unsigned report_id; unsigned field_index; unsigned usage_index; unsigned usage_code; __s32 value; } #define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) struct hiddev_report_info { unsigned report_type; unsigned report_id; unsigned num_fields; }; To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields * are unknown. Otherwise use a usage_ref struct filled in from a previous * successful GUSAGE/SUSAGE call to save time. */ usage_ref.report_type = HID_REPORT_TYPE_OUTPUT; usage_ref.report_id = 0; usage_ref.field_index = 0; usage_ref.usage_index = 0; /* which LED 0 is num lock, 1 is caps lock, 2 is scroll lock */ usage_ref.usage_code = 27; /* no one cares? */ usage_ref.value = 0; /* binary on (1) or off (0) */ ioctl(fd, HIDIOCSUSAGE, &usage_ref); rep_info.report_type = HID_REPORT_TYPE_OUTPUT; rep_info.report_id = 0; rep_info.num_fields = 1; ioctl(fd, HIDIOCSREPORT, &rep_info); 请问如何填写Byte0和Byte1这两个数据结构 |
|