Re: Q: usb_control_msg() parameters

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

 



On Fri, Feb 16, 2018 at 09:02:11AM +0200, Ran Shalit wrote:
> On Fri, Feb 16, 2018 at 8:54 AM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, Feb 16, 2018 at 01:00:06AM +0200, Ran Shalit wrote:
> >> Hello,
> >>
> >> I am trying to understand article on reverse engineering usb driver,
> >> published in
> >> http://www.linuxjournal.com/node/7353/print (2004)
> >
> > That article was written a _long_ time ago :(
> >
> >> I have difficulties understanding the input to the function usb_control_msg()
> >> especially the 0x12, 0xc8 numbers.
> >> I could not find them in the article, then tried even in the delcom
> >> datasheet, but did not find it there too.
> >> These numbers refer to __u8 request, __u8 requesttype , value, and
> >> index, but I could not understand how they are figured it out in the
> >> article.
> >>
> >>       usb_control_msg(led->udev,
> >>                       usb_sndctrlpipe(led->udev, 0),
> >>                       0x12,     <<------- ?
> >>                       0xc8,      <<------ ?
> >>                       (0x02 * 0x100) + 0x0a, <------ ?
> >>                       (0x00 * 0x100) + color, <------ ?
> >>                       buffer,
> >>                       8,
> >>                       2 * HZ);
> >
> > I thought I got them from the data sheet for the device, but that was
> > over a decade ago, so I really don't remember, sorry.
> >
> 
> My question can be more of a general question.
> I am trying to understand how I should set these arguments (in
> general) with another device for example.
> I did not find any complete example/documentation which gives more
> details as to how to set these arguments:
> 
> request - USB message request value
> requesttype - USB message request type value

These either come from the USB spec itself, or from the device spec if
it is a vendor-specific device.

> value - USB message value
> index - USB message index value

And these come from the device specification.

One such example of all of this would be the usb test and measurement
driver.  Look at the spec for that, it defines lots of control messages
and the specific values for what they need to be.  Same will be true of
your specific device as well.

Now if you don't have the spec for your device, well, that's a different
story, and you somehow have to reverse engineer it, or find it out some
other way.

Hope this helps,

greg k-h
--
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