Re: Unsupported device message, Compliance C.2, part 4
Aras Vaichas <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
Aras Vaichas wrote:
> Here is a prototype script that creates a log message when an unknown USB
> device is inserted into a particular USB host socket. It could form the basis
> for a smarter system that can handle multiple host sockets and hubs.
>
> ---- SNIP ----
>
> #!/bin/sh
>
> BASE=/sys/devices/platform/at91_ohci/usb1/1-1
>
> indicated=0
> while [ 1 ]; do
> if [ $indicated == 0 ]; then
> if [ -d "$BASE" ]; then
> indicated=1
> if [ -f "$BASE/product" ]; then
> logger "A known USB device has been inserted."
> else
> logger "An unknown USB device has been inserted."
> fi
> fi
> else
> if [ ! -d "$BASE" ]; then
> indicated=0
> fi
> fi
> sleep 1
> done
UPDATE!
I just discovered that not all devices create a "product" file when inserted,
so I've changed the script to look for a symbolic link to the device driver.
AFAIK, an unknown device will not have this link (please correct me if I am wrong).
---- SNIP ----
#!/bin/sh
BASE="/sys/devices/platform/at91_ohci/usb1/1-1/1-1:1.0"
indicated=0
while [ 1 ]; do
sleep 1
if [ $indicated == 0 ]; then
if [ -d "$BASE" ]; then
indicated=1
if [ -h "$BASE/driver" ]; then
logger "A known USB device has been inserted."
else
logger "An unknown USB device has been inserted."
fi
fi
else
if [ ! -d "$BASE" ]; then
indicated=0
fi
fi
done
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel