From: Anton S. <de...@an...> - 2013-08-22 11:30:01
|
Sorry, i've forgot to add that reading the configuration descriptor works too. 2013/8/22 Anton Smirnov <de...@an...> > I've modified libftdi code in order to test write to the device and it > works! > > code: > > // 4ntoine - just to test the device > fprintf(stderr, "try to write smth to %2x\n", ftdi->in_ep); > > unsigned char buf[2]; > buf[0] = 0x13; > buf[1] = 0x10; > int bytes_sent; > int r = libusb_bulk_transfer(ftdi->usb_dev, ftdi->in_ep, buf, 2, > &bytes_sent, ftdi->usb_write_timeout); > if (r < 0 || bytes_sent != 2) { > fprintf(stderr, "failed to send smth: %i\n (%i of %i bytes > sent)\n", r, bytes_sent, 2); > } else { > fprintf(stderr, "smth sent ok!\n"); > } > > log: > > 08-22 17:08:15.038: WARN/System.err(31143): try to write smth to 2 > 08-22 17:08:15.038: WARN/System.err(31143): libusb: 0.029727 debug > [submit_bulk_transfer] need 1 urbs for new transfer with length 2 > 08-22 17:08:15.038: WARN/System.err(31143): ioctl 1 for fd = 4 > 08-22 17:08:15.038: WARN/System.err(31143): libusb: 0.030398 debug > [libusb_get_next_timeout] next timeout in 0.299329s > 08-22 17:08:15.038: WARN/System.err(31143): libusb: 0.030826 debug > [libusb_handle_events_timeout_completed] doing our own event handling > 08-22 17:08:15.038: WARN/System.err(31143): libusb: 0.031223 debug > [handle_events] poll() 2 fds with timeout in 300ms > 08-22 17:08:15.048: WARN/System.err(31143): libusb: 0.031986 debug > [handle_events] poll() returned 1 > 08-22 17:08:15.048: WARN/System.err(31143): libusb: 0.032474 debug > [reap_for_handle] urb type=3 status=0 transferred=2 > 08-22 17:08:15.048: WARN/System.err(31143): libusb: 0.032871 debug > [handle_bulk_completion] handling completion status 0 of bulk urb 1/1 > 08-22 17:08:15.048: WARN/System.err(31143): libusb: 0.033328 debug > [handle_bulk_completion] last URB in transfer --> complete! > 08-22 17:08:15.048: WARN/System.err(31143): libusb: 0.033725 debug > [usbi_handle_transfer_completion] transfer 0x28b638 has callback 0x58ec4 > 08-22 17:08:15.048: WARN/System.err(31143): libusb: 0.034152 debug > [bulk_transfer_cb] actual_length=2 > 08-22 17:08:15.048: WARN/System.err(31143): smth sent ok! > > this confirms that standard (not vendor-specific requests can be sent). > can the problem be in libftdi kernel driver or smth like that? > > > > 2013/8/22 Toby Gray <tob...@re...> > >> On 22/08/13 08:45, Anton Smirnov wrote: >> >>> Well, i have another idea - add delays between ftdi calls. >>> FTDI device is going to be reset right after opening (unmodified libftdi >>> code). Probably i should add delays? >>> >>> I had an idea that file descriptor is invalid (it's transferred via UNIX >>> socket), but i was not be able to open the device in that case. >>> But i'm able to get usb device config, open the device and claim >>> interface. So file descriptor is good i believe. >>> >>> >> It'd be interesting to know if any standard USB requests, e.g. reading >> the configuration descriptor, work. Can you try reading the configuration >> descriptor with an explicit control request and see if that succeeds? If it >> fails then can you provide the debug output from libusb please. >> >> Regards, >> >> Toby >> > > |