Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Reboots | 21 comments | Create New Account
Click here to return to the 'Reboots' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Reboots
Authored by: lincd0 on Sep 14, '07 05:13:14PM

When you reboot, the USB devices may be enumerated in a different order than before, even though nothing has changed. I'm not sure why this happens, but it does. You may therefore get a false positive, in the sense that the post-reboot state will be different from the pre-reboot state. However, it shouldn't be too hard to verify that you have the same list of devices in a different order.

If someone wanted to write a Perl or Python script to fix this, it would be a nice contribution.

[ Reply to This | # ]

Reboots
Authored by: sweth on Sep 15, '07 01:50:56PM
As long as you don't care about the PCI version numbers and the like, you can just use
system_profiler SPUSBDataType | perl -ne '/^s{8}w/ && print' | sort
and you should get a list of attached devices that stays stable across reboots (assuming Apple doesn't change the formatting of the output of system_profiler in a new revision).

[ Reply to This | # ]
Reboots
Authored by: lincd0 on Sep 15, '07 02:28:00PM

I thought of doing something like that, but with sed instead of perl. What I'd really like, though, is to take the output of system_profiler as a plist (with the -xml option) and parse that to create a searchable database of known USB devices. Then you could add and remove those devices without raising a false alarm. You can read the plist output with defaults.

[ Reply to This | # ]