USB notes

From Helpful
(Redirected from USB2)
Jump to: navigation, search

Hardware variants

For plugs, see Common plugs and connectors#USB

PC controllers will be one of

  • OHCI (Open Host Controller Interface)
    • USB 1
    • Open standard
  • UHCI (Universal Host Controller Interface)
    • USB 1
    • Proprietary standard
    • Intel and VIA are usually UHCI
  • EHCI (Enhanced Host Controller Interface)
    • USB 2
    • public (open?) standard
  • XHCI (eXtensible Host Controller Interface)
    • USB 3
    • in theory replaces OHCI, UHCI, and EHCI

See also:


  • USB1 "Low speed"
    • ~178KByte/s (1.5 Mbit/s) of wire speed, max max ~120KByte/s of carried data due to 8b/10b coding (not yet accounting for protocol overhead)
    • Meant for devices that will never need much speed, such as keyboards
  • USB1 "Full speed"
    • 1.5MByte/s (12 Mbit/s) wire speed, ~1.2MByte/s of carried data
  • USB2 "High speed"
    • 60MByte/s (=480Mbit/s) wire speed, ~48MByte/s carried data
    • expect no more than 30MByte/s, and 25MB/s is more common (apparently because of offloading(verify))
  • USB3 "Superspeed+"
    • 625MByte/s (5Gbps) of wire speed, ~500MByte/s (4Gbps) carried data
    • Note: May do USB2 devices a little faster (as in, may reach 30-40MByte/s where many USB2 controller may stop at ~25MByte/s) (verify)
    • expect no more than ~400MB/s usually
  • USB3.1 "Superspeed+"
    • 1250MByte/s (10Gbps) of wire speed, before 128b/132b coding, ~1200MByte/s (~9Gbps) carried
    • expect no more than ~900MByte/s usually


  • Multiple ports on a hub must share their speed to the shared controller.
This means e.g. copying between two adjacent ports may happen at half the speed you expected.
(at least up to USB2.0 - USB3 became smarter about a few cases(verify))
  • USB3 modes are full-duplex, everything before was half-duplex
  • I'm ignoring USB4 for now

Related to use

Unplugging USB

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, or tell me)

Do you need to 'Safely Remove Hardware'?

the overly short tl;dr is that it's often not necessary, but because the explanation why is a bit longer than you want to remember, it's a good idea to do.

At an electric and protocol level, USB was made to be hot-pluggable, so nothing will spark.

Also, almost all drivers for USB hardware will deal with disconnect and reconnect as well.

That's not to say that the thing built on top is necessarily fine.

One good example is storage (e.g. memory sticks, external hard drives, connected cameras in storage mode), because historic filesystem APIs assume that a file stays open and available until the program that opened it says it is done.

Yanking while reading from a external storage will almost certainly make the reading program unhappy, yet the storage itself is typically fine.

Yanking while writing is usually bad.

Most filesystems write file data in-place (meaning they do not implement a guaranteed recovery)
A number of filesystems are a little more robust about filesystem metadata - but you shouldn't assume it

There are further notes.

  • Internal hard drives tend to keep a few seconds of "stuff to be written" (writeback cache)
it lets the system say "okay program I will do that for you (soon)" instead of making the program wait until it has done it
if the program writes a sequence of small chunks ("write 1K, write 1K, write 1K, write 1K"), the OS can merge that into a single "write 4K" - and other cleverness
  • other devices are written to as soon as possible (writethrough).
This is slower, but safer, because data doesn't hang around that system buffer

OSes usually opt for the safer-and-slower writethrough for external storage devices, but not always, and you can override this.

This is roughly why "if the USB stick it's no longer blinking it's probably safe enough to yank"

... in that it's probably in a consistent state. The filesystem may still record that you didn't unmount it, and do a consistency check the next time, and probably find it fine.

USB flash corrupt a little more easily while writing, because of how Flash works: writing small pieces of data to flash memory involves a read-erase-write cycle, leaving time in which the data is not on storage, and a non-obvious state to recover (SSDs, while based on Flash as well, are smarter about this than most USB sticks).

USB Device Not Recognized / Device has malfunctioned

Shown in a balloon near the task bar, with the addition that "One of the USB devices attached to this computer has malfunctioned, and windows does not recognize it."

(In some cases, if the balloon message is disabled, the device only shows up as an "Unknown Device" in the device manager.)(verify)

My summary so far is that there are many possible causes, it's hard to say which one it is, and most solutions are not very clearly good ones. Reinstalling usually won't help.

Possible problems/solutions

Things you can check easily enough:

  • broken device
    • test: try in other computers - and to be sure, also with varying OSes (some devices don't have drivers for older/specific OSes)
  • broken cable (cables get stepped, yanked, etc.)
    • if it's interchangeable, try another one.
    • If it's not interchangeable, try wiggling it to see if it accidentally makes a good contact. It's not a very good test in that it not working means nothing, but if it turns up temporarily, you know that a bit of DIYing may well fix the problem.
  • broken USB port
    • Test: Try other things in the same port, and this device in others
    • Note: each pair of ports is usually the same internal hub, so only trying the one right next to it is not the best test.
    • Simple mice are the most useful test devices, as they are low-power and do not require drivers to work
  • USB port in a weird state (often a currently blocking polyfuse, but there is another reason or two)
    • (some are more sensitive/careful than others. Macbooks's polyfuses seem to be a little notorious for triggering quickly)
    • Test/fix: Turn computer off completely (and then leave the power cord/battery out for a few minutes - not always necessary, but sometimes it is) for a few minutes.
  • crossing the power limit (particularly on a non-powered hub)
    • ...which means the device will be refused on that hub
    • Test: try plugging the device into the computer itself (or into a powered hub that has no high-powered devices)
      • Front ports may sometimes be non-powered hubs, so a back (motherboard) port is a better test.
    • Test: try a mouse in the same port - it's low-power and so very likely to work if the port's not broken.

Harder to check well:

  • stupid/missing driver for the particular device
    • Test: Try again after a restart, try with different OS, try with a different driver,
  • stupid power management bug (happens on some hardware)
    • There is/was a bug in XP(/Vista?) where power-suspended USB ports are not re-enabled properly, and there were mixed reports about Microsoft's patches (verify). Some people report that disable this port suspending feature helps.
  • windows USB driver set/setup got wonky.
    • Bit of a last resort thing to check
    • Test/fix: Uninstall as many related drivers as you can before plugging the devices back in.
  • some devices don't like sleep/hibernate, regardless of version of anything
and may stay confused until a reboot

It seems that certain devices are likelier to trigger this problem.

It seems that Windows's collection of drivers for USB devices (one or more) can get wonky. It may be that reinstalling all of these can help. Remove controllers drives last, so peripherals drivers first. Then rebooting and let it re-detect and re-install everything.

See also

Speed and latency

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, or tell me)


"Do hubs, shared cables, etc. affect speed?"

Can we go lower?

Why do some devices only work on PC ports, not from hubs?

Notes on slow USB3

On USB power and charging

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, or tell me)

USB only accidentally became a standard for charging things, which is why the history of transferring more power through it is interesting.



and standard cable, it won't try for more than 60W (at 20V).
and a heavier cable, it could give up to 100W,(verify)
..but there may be other reasons it may not go quite up to either(verify)
  • Without Power delivery (so basically in any case)
should always support 10W (2A at 5V)(verify)

Note that laptops can now use one of their USB-C plugs as a power plug, which is nice - but also note that not all chargers will be equal here (nor will all cables).

before USB-C

  • On a PC:
USB1+USB2 more or less guarantees 100mA, and may supply up to 500mA after negotiation
USB3 guarantees 150mA and may supply up to 900mA after negotiation
...'may', because the PC may deny it when it knows the total device draw is more than it has

  • generic wallplug chargers
when something doesn't present as a USB host at all, it's up to devices to behave reasonably
if a device cannot or does not check capability, they might draw at most 0.5A, but often less.

  • specific chargers
proprietary, often specific to brands
amounts to specific devices checking for specific chargers.
and sometimes negotiating for a higher voltage as well.
they may draw up to 1A or 2A, at 5V or sometimes higher.
The range here is 5W to at most 20W -- largely because wires used in USB cables cannot support more).
there were various non-standardized ways of doing this (many involved putting some voltage dividers on the data lines) - Battery Charging came later.
Names seem to include
QuickCharge (from Quallcomm)
TurboPower (from Motorola)
Adaptive Fast Charging (from Samsung)
SuperCharge (from Huawei)
Pump Express (from Mediatek),
PowerIQ (from Anker)
VOOC (from OPPO), a.k.a. Dash Charge
AiPower (from Aukey)
VoltIQ (from TronSmart)
iSmart (from RavPower)
...and both more variations, and more rebrandings. These tend to be designed for at most 10W, 15W or 20W.
introduced later (well after many not-so-standards, mentioned above)
up to 1.5A (which is 7.5W), but devices may play it safe and don't try more than 0.5A (2.5W).
no specific logo, either labeled or you have to know(verify)
I should read it, but I'm guessing it says you should only draw current until the voltage starts drooping - basically not going beyond current capability

Compared to batteries

In general, don't count on things supplying more than 2.5W (standard), or 5W or 10W if slightly special.


phones may have batteries on the order of 10Wh, that means charge will typically take at least a few hours
laptops have batteries onthe order of ~100Wh, that means a charge would take dozens of hours -- which is why we don't use USB to charge them (before USB-C, anyway)

Port limits?

It's often mentioned that USB ports have a polyfuse - a physical component specced so that drawing more than e.g. 500mA will lead to that power being disconnected.

polyfuses may, by nature, not reset until power is removed, which is why you sometimes need to completely power off a device to get that port working again

It should be noted there are other solutions.

Some things seem to monitor actual current, and use transistors to disconnect(verify).
It appears some things seem to not have this protection at all(verify), but this seems to be rare.

DIYers will know from trial and error that you can get away with drawing 0.5A without communicating at all, because most hosts assume you adhere to USB specs (and if you were an actual product, certification would require this(verify)) and neither check or disconnect you.

...and a little higher. It seems polyfuses tend to have a much higher trip current (maybe 1.5A), and also a higher-than-500mA hold current -- and probably double that for USB3.

Note that since you are defeating the thing that guarantees the power is actually available, this does mean you may be able to break communication to all devices sharing that power.

There seem to be real-world devices that cheat, like Y cables that plug into two USB ports, one of them taking power and speaking data, and the other just taking more power. I assume this is still to specs, or maybe a loophole.


Related to coding

on libusb and platforms

A primer, some terminology


Keyboard limitations

Can I give my DIY device a custom name?

Basically: not without owning a VID and registering a PID, which apparently takes five grand, and the licensing to use the USB logo will cost you more.

The one interesting footnote to that is, basically a group that bought an unused VID, and is giving the PIDs in it to open source hardware projects until they're gone.

Sublicensing this way is not allowed now, but was when this was transferred. So it's a bit of a legal game, arguably one of chicken[1]. The USB forum could revoke it, but wouldn't win much with it.

Apparently there have been various chip vendors that did something similar, but more in the form of "we'll give you a PID until you sell enough devices that you can probably afford to get your own"(verify)