mirror of
https://github.com/erjiang/usbscale.git
synced 2025-08-13 12:12:47 -06:00
Seems to be getting data now.
This commit is contained in:
parent
a9190a5703
commit
e48f9984c7
18
usbscale.c
18
usbscale.c
@ -13,7 +13,7 @@
|
|||||||
#define HID_REPORT_GET 0x01
|
#define HID_REPORT_GET 0x01
|
||||||
#define HID_RT_INPUT 0x01
|
#define HID_RT_INPUT 0x01
|
||||||
#define WEIGH_REPORT_ID 0x06 // Scale Data Report ID
|
#define WEIGH_REPORT_ID 0x06 // Scale Data Report ID
|
||||||
#define WEIGH_REPORT_SIZE 0x07
|
#define WEIGH_REPORT_SIZE 0x06
|
||||||
|
|
||||||
static libusb_device* find_scale(libusb_device**);
|
static libusb_device* find_scale(libusb_device**);
|
||||||
|
|
||||||
@ -57,21 +57,17 @@ int main(void)
|
|||||||
* test_libhid.c
|
* test_libhid.c
|
||||||
*/
|
*/
|
||||||
unsigned char data[WEIGH_REPORT_SIZE];
|
unsigned char data[WEIGH_REPORT_SIZE];
|
||||||
unsigned int len = libusb_control_transfer(
|
unsigned int len;
|
||||||
|
unsigned int res = libusb_interrupt_transfer(
|
||||||
handle,
|
handle,
|
||||||
//bmRequestType => direction: in, type: class,
|
//bmRequestType => direction: in, type: class,
|
||||||
// recipient: interface
|
// recipient: interface
|
||||||
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS |
|
LIBUSB_ENDPOINT_IN | //LIBUSB_REQUEST_TYPE_CLASS |
|
||||||
LIBUSB_RECIPIENT_INTERFACE,
|
LIBUSB_RECIPIENT_INTERFACE,
|
||||||
//bRequest => HID_REPORT_GET
|
|
||||||
// see HID1_11.pdf 60/97 (pg 51)
|
|
||||||
HID_REPORT_GET,
|
|
||||||
//wValue => hid report, no report ID
|
|
||||||
0x0100,
|
|
||||||
0x00, //windex => interface 0
|
|
||||||
data,
|
data,
|
||||||
WEIGH_REPORT_SIZE, //wLength
|
WEIGH_REPORT_SIZE, // length of data
|
||||||
10000 //timeout => 1 sec
|
&len,
|
||||||
|
10000 //timeout => 10 sec
|
||||||
);
|
);
|
||||||
int i;
|
int i;
|
||||||
printf("Got %d bytes from control transfer:\n", len);
|
printf("Got %d bytes from control transfer:\n", len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user