Re: detect attached devices

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

 



On 7/6/06, Jim Cromie <jim.cromie@xxxxxxxxx> wrote:
mgr@xxxxxxxxxxx wrote:
> Hi,
>
> I want to write a function that detects what USB devices are connected to
> the bus. How can you do that efficiently? Is it a good idea to scan the
> PCI bus?
>
> Or what do you think about the idea of using poll() and detecting changes
> in the /proc/bus/usb/devices file?
>
> Thanks.
>
> / Moge
>
>
>
a few thoughts from someone who *doesnt* know...

- notify sounds like it was meant for this.
Documentation/dnotify.txt
Documentation/filesystems/inotify.txt


- I recall something about making sysfs pollable, if it was an issue for
sysfs,
it might also be one for proc, with the additional concern that new features
are less likely to appear in procfs than sysfs.


Why don't you try the libusb package. It'll be enough if what you
intend to do is in user space.

Jinesh.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux