Jump to content

USB suspend/resume (programmable power switch)

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
plopper

plopper

    Newbie

  • Members
  • Pip
  • 3 posts
Hi!

Does anyone know how I can set USB suspend and USB resume?

I'd like to use the USB port to programmatically switch on/off the electric power to an external gadget (powered by the USB). There are "USB UART interface IC devices" which might make this possible. For example, see pages 11 and 21 in this IC documentation:
http://www.ftdichip....s/DS_FT232R.pdf

It shows a way to wire it so that one pin will be high and another pin low, when USB suspend, and vice versa for USB resume. Perfect for me, if only I could control USB suspend/resume at will...

Now, don't let the electronics of this deter you. My problem is simply that I need to know how to set USB suspend and USB resume. Preferably with C++ in Linux, but any clue, example or reference to how to use USB suspend/resume would be helpful.

#2
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
I may come up with some sample code for you, but assuming nothing but a x86 platform, you would need to probe the IRQ for the port of the device, and then use the function outb/outportb(<port>,<byte>) to set the high and low byte of the power register.

#3
plopper

plopper

    Newbie

  • Members
  • Pip
  • 3 posts
So, in principle one can switch on and off the power of a USB port by "setting the power register" with an outportb command??? Could it really be that easy, or am I misinterpreting you?

#4
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
Yeap, just that easy.
I'm assuming you don't do os-level dev, so I'm trying to find you some resources that will just use a higher level api. Heres an example with source of using the windows api to get a device name, open a pipe, and send raw control packets to a device.

http://www.delcom-en...s/USBPRGMNL.pdf