Rechecking PCI devices is equivalent to
Code: Select all
echo "1" >/sys/bus/pci/rescan
"hwrs -b" for checking for partitions; "hwrs" and "hwrs -bp" trigger both.
This probably seems silly; it's intended to be a suid tool for multiuser systems.
(Long explanation: I have an Acer Aspire One where PCI hotplug doesn't work OOB, the wireless flakes out if PCI hotplug is enabled, and both SD card readers are powered off until a card is inserted--meaning that they require PCI hotplug or a rescan.
Also, I run into problems with removable devices not getting partitions enumerated until I try mounting them or something like that; this throws off setting up /etc/fstab for user mount.
I didn't want to login as root every time I plugged in an SD card, so I needed some sort of suid helper, which meant writing it in C...)
It's written as a "toy" for toybox (the equivalent of an "applet" in busybox). To build it, get a recent version of the toybox source, then drop hwrs.c in toys/pending/ and type
Code: Select all
CFLAGS="-Os -static" scripts/single.sh hwrs
This build is linked statically with a fairly current musl and sstrip'ed.