hidraw and USB Device Strings

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

 



Hello,

I'm using the hidraw driver with a USB device and would like to get some
of the string information from the device (Vendor, Product, Serial, and
arbitrary strings by string id). I'd like to add ioctls to do this, and
I think it could be fairly straight-forward. The problem I'm seeing
right now is that hidraw doesn't know anything about usb (and it does it
include usb.h).

I assume this is by design, since not all HID devices are necessarily
USB devices. I can understand that design decision. The majority of hid
devices in the real world though are USB, so I think it makes sense to
be able to get USB information if it's available.

I took a look at hiddev.c, which will return arbitrary USB strings, and
it works by calling usb_*() functions directly, as hiddev is part of the
usbhid driver, which of course has USB dependencies.

Further, some of the device-specific files in drivers/hid/ use the
macros to_usb_interface() and interface_to_usbdev() to get a pointer to
the struct usb_device. This seems like it would work great, but only if
you could _guarantee_ that you're a USB device, and not another type of
HID device (as these simply use the container_of() macros). Maybe
bus_type.name could be checked, but it seems like there must be a better
way than string comparison.

So my questions are then, what's the best way to go about this in a
clean way? How can I get USB specific functionality into what's
currently a bus-independent file cleanly (in a way that will be
accepted)? Is there an alternative solution that I may have missed somehow?

This is my first post to a kernel-related mailing list, so please
forgive me if I don't get all the protocol right. I've read the FAQs and
several of the instructional files in the source as well (but that
doesn't mean I remember it all).

Please let me know, and thanks for your help,

Alan.


--
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