• Home
  • Raw
  • Download

Lines Matching refs:ptp_usb

64 static inline int get_timeout(PTP_USB* ptp_usb) {  in get_timeout()  argument
65 if (FLAG_LONG_TIMEOUT(ptp_usb)) { in get_timeout()
80 PTP_USB *ptp_usb; member
94 static void close_usb(PTP_USB* ptp_usb);
104 static void clear_stall(PTP_USB* ptp_usb);
105 static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, openusb_dev_handle_t * dev);
108 static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status);
683 void dump_usbinfo(PTP_USB *ptp_usb) { in dump_usbinfo() argument
686 openusb_parse_device_desc(libmtp_openusb_handle, *ptp_usb->handle, NULL, 0, &desc); in dump_usbinfo()
694 LIBMTP_INFO(" IN endpoint maxpacket: %d bytes\n", ptp_usb->inep_maxpacket); in dump_usbinfo()
695 LIBMTP_INFO(" OUT endpoint maxpacket: %d bytes\n", ptp_usb->outep_maxpacket); in dump_usbinfo()
697 LIBMTP_INFO(" Bus location: %d\n", ptp_usb->rawdevice.bus_location); in dump_usbinfo()
698 LIBMTP_INFO(" Device number: %d\n", ptp_usb->rawdevice.devnum); in dump_usbinfo()
700 LIBMTP_INFO(" Vendor: %s\n", ptp_usb->rawdevice.device_entry.vendor); in dump_usbinfo()
701 LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.vendor_id); in dump_usbinfo()
702 LIBMTP_INFO(" Product: %s\n", ptp_usb->rawdevice.device_entry.product); in dump_usbinfo()
703 LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.product_id); in dump_usbinfo()
704 LIBMTP_INFO(" Device flags: 0x%08x\n", ptp_usb->rawdevice.device_entry.device_flags); in dump_usbinfo()
716 const char *get_playlist_extension(PTP_USB *ptp_usb) { in get_playlist_extension() argument
720 openusb_parse_device_desc(libmtp_openusb_handle, *ptp_usb->handle, NULL, 0, &desc); in get_playlist_extension()
788 PTP_USB *ptp_usb = (PTP_USB *) data; in ptp_read_func() local
799 uint16_t ptp_dev_vendor_id = ptp_usb->rawdevice.device_entry.vendor_id; in ptp_read_func()
803 usb_inep_maxpacket_size = ptp_usb->inep_maxpacket; in ptp_read_func()
825 if (readzero && FLAG_NO_ZERO_READS(ptp_usb) && toread % 64 == 0) { in ptp_read_func()
857 bulk.timeout = ptp_usb->timeout; in ptp_read_func()
860 ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); in ptp_read_func()
885 ptp_usb->current_transfer_complete += xread; in ptp_read_func()
889 if (ptp_usb->callback_active) { in ptp_read_func()
890 if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { in ptp_read_func()
892 ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; in ptp_read_func()
893 ptp_usb->callback_active = 0; in ptp_read_func()
895 if (ptp_usb->current_transfer_callback != NULL) { in ptp_read_func()
897 ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, in ptp_read_func()
898 ptp_usb->current_transfer_total, in ptp_read_func()
899 ptp_usb->current_transfer_callback_data); in ptp_read_func()
914 !FLAG_NO_ZERO_READS(ptp_usb) && in ptp_read_func()
915 curread % ptp_usb->outep_maxpacket == 0) { in ptp_read_func()
932 bulk.timeout = ptp_usb->timeout; in ptp_read_func()
935 ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); in ptp_read_func()
950 PTP_USB *ptp_usb = (PTP_USB *) data; in ptp_write_func() local
972 if (towrite > ptp_usb->outep_maxpacket && towrite % ptp_usb->outep_maxpacket != 0) { in ptp_write_func()
973 towrite -= towrite % ptp_usb->outep_maxpacket; in ptp_write_func()
990 bulk.timeout = ptp_usb->timeout; in ptp_write_func()
993 ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->outep, &bulk); in ptp_write_func()
1004 ptp_usb->current_transfer_complete += xwritten; in ptp_write_func()
1009 if (ptp_usb->callback_active) { in ptp_write_func()
1010 if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { in ptp_write_func()
1012 ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; in ptp_write_func()
1013 ptp_usb->callback_active = 0; in ptp_write_func()
1015 if (ptp_usb->current_transfer_callback != NULL) { in ptp_write_func()
1017 ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, in ptp_write_func()
1018 ptp_usb->current_transfer_total, in ptp_write_func()
1019 ptp_usb->current_transfer_callback_data); in ptp_write_func()
1034 if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { in ptp_write_func()
1035 if ((towrite % ptp_usb->outep_maxpacket) == 0) { in ptp_write_func()
1051 bulk.timeout = ptp_usb->timeout; in ptp_write_func()
1054 ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->outep, &bulk); in ptp_write_func()
1214 PTP_USB *ptp_usb = (PTP_USB *) params->data; in ptp_usb_senddata() local
1216 packet_size = ptp_usb->inep_maxpacket; in ptp_usb_senddata()
1282 PTP_USB *ptp_usb = (PTP_USB *) params->data; in ptp_usb_getpacket() local
1284 packet_size = ptp_usb->inep_maxpacket; in ptp_usb_getpacket()
1312 PTP_USB *ptp_usb = (PTP_USB *) params->data; in ptp_usb_getdata() local
1333 if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { in ptp_usb_getdata()
1355 if (rlen == ptp_usb->inep_maxpacket) { in ptp_usb_getdata()
1405 } else if (!FLAG_NO_ZERO_READS(ptp_usb) && in ptp_usb_getdata()
1434 if (FLAG_NO_ZERO_READS(ptp_usb) && in ptp_usb_getdata()
1435 len + PTP_USB_BULK_HDR_LEN == ptp_usb->inep_maxpacket) { in ptp_usb_getdata()
1454 bulk.timeout = ptp_usb->timeout; in ptp_usb_getdata()
1457 result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); in ptp_usb_getdata()
1461 …d not read in extra byte for %d bytes long file, return value 0x%04x\n", ptp_usb->inep_maxpacket, … in ptp_usb_getdata()
1462 …} else if (len + PTP_USB_BULK_HDR_LEN == ptp_usb->inep_maxpacket && params->split_header_data == 0… in ptp_usb_getdata()
1478 bulk.timeout = ptp_usb->timeout; in ptp_usb_getdata()
1481 … zeroresult = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); in ptp_usb_getdata()
1509 PTP_USB *ptp_usb = (PTP_USB *) (params->data); in ptp_usb_getresp() local
1547 if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { in ptp_usb_getresp()
1576 PTP_USB *ptp_usb = (PTP_USB *) (params->data); in ptp_usb_event() local
1598 bulk.timeout = ptp_usb->timeout; in ptp_usb_event()
1601 result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); in ptp_usb_event()
1615 bulk.timeout = ptp_usb->timeout; in ptp_usb_event()
1618 … result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); in ptp_usb_event()
1634 bulk.timeout = ptp_usb->timeout; in ptp_usb_event()
1637 result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); in ptp_usb_event()
1651 bulk.timeout = ptp_usb->timeout; in ptp_usb_event()
1654 … result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); in ptp_usb_event()
1710 PTP_USB *ptp_usb = (PTP_USB *) (params->data); in ptp_usb_control_cancel_request() local
1731 ctrl.timeout = ptp_usb->timeout; in ptp_usb_control_cancel_request()
1735 ret = openusb_ctrl_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->outep, &ctrl); in ptp_usb_control_cancel_request()
1741 static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, openusb_dev_handle_t* dev) { in init_ptp_usb() argument
1751 params->data = ptp_usb; in init_ptp_usb()
1759 ptp_usb->timeout = get_timeout(ptp_usb); in init_ptp_usb()
1766 ptp_usb->handle = malloc(sizeof(openusb_dev_handle_t)); in init_ptp_usb()
1767 *ptp_usb->handle = device_handle; in init_ptp_usb()
1786 usbresult = openusb_claim_interface(device_handle, ptp_usb->interface, USB_INIT_DEFAULT); in init_ptp_usb()
1791 if (FLAG_SWITCH_MODE_BLACKBERRY(ptp_usb)) { in init_ptp_usb()
1814 ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); in init_ptp_usb()
1835 ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); in init_ptp_usb()
1856 ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); in init_ptp_usb()
1877 ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); in init_ptp_usb()
1886 static void clear_stall(PTP_USB* ptp_usb) { in clear_stall() argument
1921 static void clear_halt(PTP_USB* ptp_usb) { in clear_halt() argument
1940 static void close_usb(PTP_USB* ptp_usb) { in close_usb() argument
1941 if (!FLAG_NO_RELEASE_INTERFACE(ptp_usb)) { in close_usb()
1952 clear_stall(ptp_usb); in close_usb()
1954 clear_halt(ptp_usb); in close_usb()
1961 if (FLAG_FORCE_RESET_ON_CLOSE(ptp_usb)) { in close_usb()
1969 openusb_reset(*ptp_usb->handle); in close_usb()
1971 openusb_close_device(*ptp_usb->handle); in close_usb()
2062 PTP_USB *ptp_usb; in configure_usb_device() local
2099 ptp_usb = (PTP_USB *) malloc(sizeof (PTP_USB)); in configure_usb_device()
2100 if (ptp_usb == NULL) { in configure_usb_device()
2105 memset(ptp_usb, 0, sizeof (PTP_USB)); in configure_usb_device()
2108 memcpy(&ptp_usb->rawdevice, device, sizeof (LIBMTP_raw_device_t)); in configure_usb_device()
2114 if (FLAG_ALWAYS_PROBE_DESCRIPTOR(ptp_usb)) { in configure_usb_device()
2122 &ptp_usb->conf, in configure_usb_device()
2123 &ptp_usb->interface, in configure_usb_device()
2124 &ptp_usb->altsetting, in configure_usb_device()
2125 &ptp_usb->inep, in configure_usb_device()
2126 &ptp_usb->inep_maxpacket, in configure_usb_device()
2127 &ptp_usb->outep, in configure_usb_device()
2128 &ptp_usb->outep_maxpacket, in configure_usb_device()
2129 &ptp_usb->intep); in configure_usb_device()
2138 ptp_usb->bcdusb = desc.bcdUSB; in configure_usb_device()
2141 if (init_ptp_usb(params, ptp_usb, ldevice) < 0) { in configure_usb_device()
2153 openusb_reset(*ptp_usb->handle); in configure_usb_device()
2154 close_usb(ptp_usb); in configure_usb_device()
2156 if (init_ptp_usb(params, ptp_usb, ldevice) < 0) { in configure_usb_device()
2179 openusb_release_interface(*ptp_usb->handle, ptp_usb->interface); in configure_usb_device()
2184 *usbinfo = (void *) ptp_usb; in configure_usb_device()
2188 void close_device(PTP_USB *ptp_usb, PTPParams *params) { in close_device() argument
2191 close_usb(ptp_usb); in close_device()
2194 void set_usb_device_timeout(PTP_USB *ptp_usb, int timeout) { in set_usb_device_timeout() argument
2195 ptp_usb->timeout = timeout; in set_usb_device_timeout()
2198 void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout) { in get_usb_device_timeout() argument
2199 *timeout = ptp_usb->timeout; in get_usb_device_timeout()
2202 int guess_usb_speed(PTP_USB *ptp_usb) { in guess_usb_speed() argument
2211 switch (ptp_usb->bcdusb & 0xFF00) { in guess_usb_speed()
2230 static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status) { in usb_get_endpoint_status() argument
2245 ctrl.timeout = ptp_usb->timeout; in usb_get_endpoint_status()
2251 openusb_ctrl_xfer(*ptp_usb->handle, ptp_usb->interface, ep, &ctrl); in usb_get_endpoint_status()