Home | History | Annotate | Download | only in cts-usb-accessory

Lines Matching refs:device

72 static int send_string(struct usb_device *device, int index, const char* string) {
73 int ret = usb_device_control_transfer(device, USB_DIR_OUT | USB_TYPE_VENDOR,
88 struct usb_device *device = usb_device_open(devname);
89 if (!device) {
94 char* serial = usb_device_get_serial(device);
101 vendorId = usb_device_get_vendor_id(device);
102 productId = usb_device_get_product_id(device);
111 printf("Found Android device in accessory mode (%x:%x)...\n",
113 sDevice = device;
116 usb_descriptor_iter_init(device, &iter);
137 if (usb_device_claim_interface(device, intf->bInterfaceNumber)) {
152 printf("Found possible Android device (%x:%x) "
156 ret = usb_device_control_transfer(device, USB_DIR_IN | USB_TYPE_VENDOR,
159 printf("Device supports protocol version %d\n", protocol);
165 send_string(device, ACCESSORY_STRING_MANUFACTURER, "Android CTS");
167 send_string(device, ACCESSORY_STRING_MODEL, "CTS USB Accessory");
169 send_string(device, ACCESSORY_STRING_DESCRIPTION, "CTS USB Accessory");
171 send_string(device, ACCESSORY_STRING_VERSION, "1.0");
173 send_string(device, ACCESSORY_STRING_URI,
176 send_string(device, ACCESSORY_STRING_SERIAL, "1234567890");
179 usb_device_control_transfer(device, USB_DIR_OUT | USB_TYPE_VENDOR,
187 if (device != sDevice)
188 usb_device_close(device);