Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is USB power always enabled ? And if not, how to write a driver

Tags:

driver

usb

I have a device that came with an AC power adapter where the connector is a mini USB plug. The device however doesn't seem to power itself from a computer's USB port (using a standard USB-mini USB cable) unless a specific driver is installed. The driver is only available for Windows. I would like to charge the device from USB plugs on different platforms.

My question is: why isn't power getting to the device without the driver? Is a driver always required for a USB port to start giving power? Or is it this device that's specifically made not to take a charge unless some software routine triggers it to do so?

I guess my question can be summarized as: Is power not present on the USB cable or is it present but the device ignoring it. If the answer is the former, I'll be trying to figure out how to write software that will enable the voltage to always be present.

Thanks

like image 897
srmark Avatar asked Jun 09 '09 17:06

srmark


3 Answers

Why isn't power getting to the device without the driver?

USB ports are always powered when the computer is on and the USB control software hasn't detected current overdraw.

Is a driver always required for a USB port to start giving power?

No, the USB port is always required to start off providing power to the device, otherwise the device could never initiate a connection.

Or is it this device that's specifically made not to take a charge unless some software routine triggers it to do so?

This can be complex. To meet the USB spec a device cannot pull more than a few mA until it's registered with the computer.

However, nearly every computer allows the USB port to pull the full 500mA (and more) before it'll shut the power off.

The device you're charging is being nice by not pulling any significant power until the computer gives permission.

Writing software won't help, the device has to register with the USB bus, which will best be done with the driver.

However, the plug in charger doesn't do that. It likely has shorted the two data lines of the USB plug together, which signals the USB device that it's not connected to a computer and can pull the full 500mA without waiting.

Take a USB extension cable, cut off the jacket, and short the data lines (green and yellow, sometimes) together on the end going to the USB device, and leave them cut without touching anything on the end going to the PC, and leave the read and black power wires connected through.

It might work. If not, take the wall charger apart and find out what it's doing with each of the four USB wires, and see if you can duplicate that.

like image 158
Adam Davis Avatar answered Oct 15 '22 05:10

Adam Davis


This might be helpful if you are targeting a linux system.

like image 3
Albinofrenchy Avatar answered Oct 15 '22 06:10

Albinofrenchy


This seems to be platform-specific. In Linux, USB ports are always energized, while on Windows they don't. Thumbdrives with LEDs turn off when unmounted in windows, but in Linux they stay lit. My cellphone's manual says that it can't be charged by a PC, but I regularly do on my linux machine, I guess that's because they don't have a driver and windows won't power up without one.

like image 3
Javier Avatar answered Oct 15 '22 06:10

Javier