Re: Attaching MEGAWIN USB Bridge with USB generic driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried a bit around and found out that calling my program as root eliminates
that issue.

No I made a huge step forward: I can send the first messages and now stuck on
dealing with control in messages.

Again, I try to reproduce the URBs created by the windows driver. This method
should generate the first of them:

// Starts a read process
static bool ReadDataAsync(char *Buffer, int nSize, int *ReadResultSize, int
TimeOut){
	global_Buffer = Buffer;
	int retval = usb_control_msg(usb_handle,
                    0x000000c0,				// request type
                    0x00000004,				// request
                    0x00005002,				// value
                    0x00000000,				// index
                    Buffer,					// bytes
                    nSize,					// size
                    TimeOut);				// timeout
	fprintf(stderr, "usb_control_msg returned with: %d\n", retval);
	*ReadResultSize = retval;
	return (retval>=0);
}

This function is called in the main:
  int MAX_BYTES = 4000;
  char in_buffer[MAX_BYTES];
  int byte_count = 0;
  [...] // init and (successfully sent) data request
  ReadDataAsync(in_buffer, MAX_BYTES, &byte_count, 5000);

It produces this output with usbmon:
[...] lines produced by libusb-init
dcab9b00 2859906422 S Co:2:003:0 s 40 0c 5003 00f0 0001 1 = 10
dcab9b00 2859910310 C Co:2:003:0 0 1 >
dcab9b00 2859917974 S Co:2:003:0 s 40 0c 5003 ffff 0001 1 = d0
dcab9b00 2859921313 C Co:2:003:0 0 1 >
dcab9b00 2859921742 S Co:2:003:0 s 40 04 5001 0000 0005 5 = 91010001 93
dcab9b00 2859930306 C Co:2:003:0 0 5 >
dcab9b00 2859938572 S Ci:2:003:0 s c0 04 5002 0000 0fa0 4000 <
dc7ce700 2861983481 C Ii:1:001:1 -2:2048 0
dc7ce500 2862869772 C Ii:3:001:1 -2:128 0
dcab9b00 2864939765 C Ci:2:003:0 -2 0

The urb status -2 is -ENOENT and shall mean: "URB was synchronously unlinked by
usb_unlink_urb"

Finally the question: How do I do "control in transfers" with libusb? Is there
some kind of example/documentation?

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux