Hi,

On Tue, Oct 28 at 12:39, Edward Beckmann wrote:
> Thanks for the replies so far - one problem, the externals I am thinking of
> have no power supply or separate switch - I need to turn off the power from
> the USB port they are plugged into (and where they get their power from).  I
> am trying to avoid lots of plugging and unplugging the USB lead.

How happy are you with the C compiler ?

I don't know of an off the shelf utility for this but I've had some
success with the hub-ctl program from NIIBE Yutaka[1].

Actually compilation of the single source file is simple enough.

$ cc -o hub-ctrl hub-ctrl.c -lusb

Assuming you have libusb installed (on gentoo it's "emerge libusb").


Then it's simply "hub-ctrl -b 1 -d 2 -P 3 -p 0" to turn power off, and
"hub-ctrl -b 1 -d 2 -P 3 -p 1" to turn it back on.

In my example 1 is the bus the *hub* is attached to, and 2 is the device
number of the *hub*, 3 is the port on the hub that you wish to control.

Determining the port number is either a case of checking the hub circuit
diagram or trial and error.  Hub port numbers never follow a logical
layout or the numbering on the case.  ie and 8 port unit I know has the
ports left to right in the following order 1 2 3 4 7 8 6 5.


Add the hub-ctrl commands to a script that mounts/unmounts the drive as
you require.


[1] http://marc.info/?l=linux-usb-devel&m=113724451205634&w=2
-- 
        Bob Dunlop

-- 
Please post to: Hampshire@mailman.lug.org.uk
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------

Reply via email to