Find the answer to your Linux question:
Results 1 to 3 of 3
Hi I have an application in which USB should get detected and signal has to be recieved, My question is should that be handled in driver I have heard about ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    1

    Unhappy USB detection

    Hi I have an application in which USB should get detected and signal has to be recieved, My question is should that be handled in driver
    I have heard about the message being sent from kernel space to user space; is it that which has to be done,.. I went through lot of material which explains about /sbin/hotplug but couldnot get that to work....
    anybody can give me suggestions or better stuffs to read or help in anyway ??

  2. #2
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    99
    I don't know is that suit for you or not.

    are you using udevd device controller?
    if that.
    try command
    udevinfo -a -p $(udevinfo -q path -n /dev/sda1) <-- try to find your USB DISK uuid.

    so add one file in
    /etc/udev/rules.d/75-custom.rules
    KERNEL=="sd[a-z][0-9]", SYSFS{serial}==" input your UUID here", PROGRAM=="input your script here."

    try it.

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    45
    Answer:
    Quote Originally Posted by signmem
    I don't know is that suit for you or not.

    are you using udevd device controller?
    if that.
    try command
    Code:
    udevinfo -a -p $(udevinfo -q path -n /dev/sda1) <-- try to find your USB DISK uuid.
    so add one file in
    /etc/udev/rules.d/75-custom.rules
    Code:
    KERNEL=="sd[a-z][0-9]", SYSFS{serial}==" input your UUID here", PROGRAM=="input your script here."
    try it.
    This only works when the device in question actually uses the USB block device kernel interface, which I very much doubt. For what itʼs worth, it could use any of the many USB interfaces for which a kernel module exists (i.e. the HID or even input subsystem), as «kewl» didnʼt specify what the device actually is.

    Quote Originally Posted by kewl
    Hi I have an application in which USB should get detected and signal has to be recieved, My question is should that be handled in driver
    I have heard about the message being sent from kernel space to user space; is it that which has to be done,.. I went through lot of material which explains about /sbin/hotplug but couldnot get that to work....
    anybody can give me suggestions or better stuffs to read or help in anyway ??
    If it already is a HID device, then the hiddev kernel driver automatically registeres with the device on connection time and creates a character device node interface at «/dev/hiddev$NO». HID documentation is available at ¹ and «Documentation/usb/hiddev.txt» in your kernel source directory. It is easy to determine if a device is a HIDdev device: if the invocation of «dmesg» mentions something about “hiddev” on its last lines after you plugged the device in question in, then it is most likely a HID device.

    If neither case above applies, which means that the device has no associated kernel interface / driver (i.e. because itʼs custom made), then no USB related kernel driver registeres with the device and one is free to communicate with the device in userspace. The easiest way to accomplish this would probably be «libusb»². However the usage of «libusb» requires some knowledge of USB. In the case this knowledge is not sufficient, I recommend reading each ³, ⁴ and ², in that order.

    Footnotes:
    1. USB – HID Specification 1.11
    2. Home: SourceForge.net: libusb home. Documentation: libusb Developers Guide offers a plethora of neccessary information.
    3. USB Revision 3.0 Specification
    4. Programming Guide for Linux USB Device Drivers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...