usb.h (651B)
1 // Copyright 2014, Brian Swetland <swetland@frotz.net> 2 // Licensed under the Apache License, Version 2.0. 3 4 #ifndef _USB_H_ 5 #define _USB_H_ 6 7 #include <stdint.h> 8 9 typedef struct usb_handle usb_handle; 10 11 /* simple usb api for devices with bulk in+out interfaces */ 12 13 usb_handle *usb_open(unsigned vid, unsigned pid, const char* sn); 14 void usb_close(usb_handle *usb); 15 int usb_read(usb_handle *usb, void *data, int len); 16 int usb_read_forever(usb_handle *usb, void *data, int len); 17 int usb_write(usb_handle *usb, const void *data, int len); 18 int usb_ctrl(usb_handle *usb, void *data, 19 uint8_t typ, uint8_t req, uint16_t val, uint16_t idx, uint16_t len); 20 #endif