I am wondering if I can enable / disable the USB ports programmatically using Python, or a script I can call from Python on the Pi?
I have a DSLR camera attached via USB. Typically when the camera sees it is attached via USB it goes into "PC" mode. I want to be able to enabled the USB - then copy the camera photos from the camera, then disable the USB to allow more photos to be taken.
I found the following:
# disable external wake-up; do this only once
echo disabled > /sys/bus/usb/devices/usbX/power/wakeup
echo on > /sys/bus/usb/devices/usbX/power/level # turn on
echo suspend > /sys/bus/usb/devices/usbX/power/level # turn off
where usbX is the appropriately numbered port, i.e. usb1, usb2, etc.
Anyone think this will work on a Pi? I haven't had lab time to try this yet.