The fundamentals of the USB interface, and the support for toasters
USB came about because the back of computers started to look like flight cockpit controls, i.e there were far too many plugs essentially serving the same purpose: getting data into, and out of the computer. You had different cables for keyboard/mouse, speakers, printers, you get the idea. People got sick of it and said "let's standardize this"[?]Standards are hit or miss, we got lucky here... Example., so we got USB. Universal Serial Bus. Serial meaning data is sent one bit (0 or 1) at a time and bus meaning to get from one location to another.USB operates under the master/slave architecture (that is officially the terminology)[?]This is becoming the center of controversy in this day and age, here's a good entry reading into the matter. as in, clients can't talk to each other directly, they must go through the host. If you want to print a photo from your USB thumbdrive to your USB printer, your thumbdrive sends the image data to the host, the host sends the data to the printer. One of the reasons this architecture was brought about was to simply operations and make it as easy as possible for the users. Here's an example for you. You've got your standard male "rectangle" USB side of the cable (it's referred to as "male" because it inserts) and another connector on the end which takes on various forms, but never again the rectangle[?]Ok, never is strong. For a buck you can get a USB type A to USB type A cable on ebay for a buck. Point is, you're unlikely to come across them unless you're looking for them.. This makes it impossible for users to get confused and plug a host into a host, or client to client.Internally, USB has four copper cables, two for power, and two for data transmission. You'll rarely find a cable with only two wires - just power, which infuriate me because the cost of including the other two cables is inconceivably low. That, and there's a lot of frustration when you realise you can't transfer photos from your phone to the computer because the cable manufacturer was a tight ass... To their credit though, if you've plugged your phone into a "public phone charger", say, at an airport, there's a good chance it was stealing data from your phone whilst distracting you with the fact that you're getting "free" charge. So two cable USBs do have the benefit of being more secure. But this is a niche use case and I still think two cabled USB cables should be ILLEGAL. Hahaha where was I?Despite the fact that there are two data cables, you can only send information one way. It's like walkie talkie communication. The USB device goes "hey, here's the keyboard keys the user just pressed, over" then the host goes "received, over". When you do a phone call with a USB headset, it just flickers between sending and receiving so fast, to you it seems communication is two way.There's an little-known "green" power saving mode in USB, where if a device is unneeded, it will draw minuscule amounts of power until it wakes up again. Now here's a joke, you'd expect your device to go to sleep if it hasn't been used for, say, 5 or 10 minutes right? Well "sleep mode" is defined as the device not saying anything for three milliseconds. That's right, hundreds of times a second, all your USB devices are talking to your computer (not even always with anything useful, often just: "I'm here, don't put me to sleep").Data is transmitted to the computer in "packets" or "frames". On a letter, you'd write the address, the letter, then add a stamp. Computer communication is similar. Packets are small sets of 0 and 1s and are made up as such. A USB packet looks like this:When you connect a USB device the computer goes "who are you, and what do you do?", the device answers then the host responds and says "sweet, I'll call you device 84" and the device will confirm: "sweet, I'm device 84". As in the picture above, sync says "Hey I'm about to talk, listen up", PID (process ID) says: "I'm device 84, the mouse, remember me?", data is the payload, CRC16 is the data confirmation, it's essentially a math equation to confirm the information was received correctly and not corrupted (find out more here under "First Example"), and EOP (end of packet) is the device going "over".These are the formalities encasing our data, similar to the letter example. The makeup of data is wildly different between USB devices, but we'll quickly look at a mouse's data frame.In our example above, the mouse is reporting to the computer that the user is clicking the left mouse button, scrolled 100 units down and moved north-left, 40 units north, 50 units left.
You promised me toasters!
In 2014, a user asked a tech forum why his Windows 7 computer said his keyboard was a USB toaster. To explain and ruin the joke: a "toaster" is a term for an arbitrary device. Windows documentation has an example file on how to give your USB device information like a model number. In this example, there's the line: '<DeviceIconFile>Toaster.ico</DeviceIconFile>`, which is saying, here's how you set the device icon for an arbitrary device, but make sure you specify it for your device. Well the maker of the forum user's keyboard seems to have copied the sample and forgot to change the icon reference, so when he plugged in his keyboard, his computer thought it was a toaster. Well now that I know there is support USB toasters, I'm left wondering why I'm still plugging my toaster into a power outlet like a Neanderthal...