Sign in to follow this  
Followers 0
Gui

Run a USB Device via AutoIt

9 posts in this topic

Let's say I have a USB device, a USB light to be specific. Is it possible via AutoIt to either turn it on or off? Since just by plugging it in into the USB port it turns on, would you take control of the driver port and enable / disable it? First of course you'd have to locate the driver port, which as to my knowledge is possible using the DeviceAPI.

Any other ideas/suggestions/methods I'll take, as long as it works!

Thanks!

GUI

Share this post


Link to post
Share on other sites



most USB flash drives work the same as a HDD. on a computer, the HDD doesnt actually control the LED that shows drive activity. its the motherboard that does.

turnning off the LED on the USB drive would mean turning off the power to the drive which is as simple as disabling the port.

Share this post


Link to post
Share on other sites

So is it possible to disable a port via AutoIt? Or does the Device API UDF have the ability to do so?

Share this post


Link to post
Share on other sites

i wouldnt be surprised if AutoIT could but i dont know the function to do that.

Share this post


Link to post
Share on other sites

I know what you mean ;p AutoIt is powerful and most people fail to realize that. Meh I'll check out the UDF (http://www.fallenstar.net/autoit/DeviceAPI.au3). Perhaps it can do it. I'm just unfamiliar with drivers period.

Share this post


Link to post
Share on other sites

A light that is powered by the USB port is powered by the 5 volts that is always present on the port. I don't think there's any way to shut off that voltage to the port, there might be a way to power off the port but I wouldn't know of one myself. Some motherboards may not even allow it if the voltage comes directly from the power supply.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

A light that is powered by the USB port is powered by the 5 volts that is always present on the port. I don't think there's any way to shut off that voltage to the port, there might be a way to power off the port but I wouldn't know of one myself. Some motherboards may not even allow it if the voltage comes directly from the power supply.

Yeah that makes sense. Ugh well i'm using the USB light as an example for testing. I'd just like be able to control the ports and/or what's attached to it for future purposes. Thanks for your insight!

Share this post


Link to post
Share on other sites

A light that is powered by the USB port is powered by the 5 volts that is always present on the port. I don't think there's any way to shut off that voltage to the port, there might be a way to power off the port but I wouldn't know of one myself. Some motherboards may not even allow it if the voltage comes directly from the power supply.

Brewman is right. The USB light has no circuitry to interprete any control signals sent over USB - it simply connects to the +5V and GND wire to sponge up power.

From memory, UHCI host controllers can shut off power to ports, but thats something thats managed deep inside the code of an OS, not something thats available to programmers.


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites

wraithdu wrote an example script that can safely eject a USB drives and such. Might be what you are looking for in most situations.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0