1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>/proc/bus/usb/devices</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux-USB Host Side API"><link rel="up" href="usbfs.html" title="Chapter 7. The USB Filesystem (usbfs)"><link rel="prev" href="usbfs-fstab.html" title="Mounting and Access Control"><link rel="next" href="usbfs-bbbddd.html" title="/proc/bus/usb/BBB/DDD"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">/proc/bus/usb/devices</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="usbfs-fstab.html">Prev</a> </td><th width="60%" align="center">Chapter 7. The USB Filesystem (usbfs)</th><td width="20%" align="right"> <a accesskey="n" href="usbfs-bbbddd.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="usbfs-devices"></a>/proc/bus/usb/devices</h2></div></div></div><p>This file is handy for status viewing tools in user 2 mode, which can scan the text format and ignore most of it. 3 More detailed device status (including class and vendor 4 status) is available from device-specific files. 5 For information about the current format of this file, 6 see the 7 <code class="filename">Documentation/usb/proc_usb_info.txt</code> 8 file in your Linux kernel sources. 9 </p><p>This file, in combination with the poll() system call, can 10 also be used to detect when devices are added or removed: 11</p><pre class="programlisting">int fd; 12struct pollfd pfd; 13 14fd = open("/proc/bus/usb/devices", O_RDONLY); 15pfd = { fd, POLLIN, 0 }; 16for (;;) { 17 /* The first time through, this call will return immediately. */ 18 poll(&pfd, 1, -1); 19 20 /* To see what's changed, compare the file's previous and current 21 contents or scan the filesystem. (Scanning is more precise.) */ 22}</pre><p> 23 Note that this behavior is intended to be used for informational 24 and debug purposes. It would be more appropriate to use programs 25 such as udev or HAL to initialize a device or start a user-mode 26 helper program, for instance. 27 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usbfs-fstab.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="usbfs.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="usbfs-bbbddd.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Mounting and Access Control </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> /proc/bus/usb/BBB/DDD</td></tr></table></div></body></html> 28