Wikipedia:Reference desk/Archives/Computing/2015 August 3

= August 3 =

USB drive letters
In Windows 7, is it possible to permanently assign a drive letter to a particular physical USB port? Alternatively, given a list of USB drive letters, is it possible to determine which physical port each is connected to? The various on-line resources I can find give instructions on how to assign a fixed drive letter to a particular USB _device_, but I'd like to assign a fixed letter to a particular USB _port_ - ideally, without having to actually plug a USB stick into it. Tevildo (talk) 20:32, 3 August 2015 (UTC)


 * Ports are ports and drives are drives. Ports do not have address as they are just sockets on a bus. Only the plugged in devices have address. Which is a complicated way of me saying no way... not ever! can you give a port an address Not on windoz, not on Linux, not on OS2, etc.--Aspro (talk) 22:26, 3 August 2015 (UTC)


 * To rephrase the above answer a bit, no. Your computer doesn't have any knowledge of the physical location of the ports, like "this is the second USB port from the left on the front of the case". The physical ports are just interchangeable wires hooked up to an electrical bus. --108.38.204.15 (talk) 22:37, 3 August 2015 (UTC)
 * That's disappointing. Just to clarify:  If I go to Device Manager, and select one of the devices listed in Universal Serial Bus Controllers > USB Mass Storage Device, I see a property "Location: Port_#0001.Hub_#0003".  Are those numbers in any way permanent, or do they change whenever the computer is rebooted or a different device is plugged in?  If not - if those numbers do correspond to a physical location - is there a method (not necessarily a _convenient_ method, is it at all theoretically possible) - to determine what they are if I know the drive letter?  Tevildo (talk) 23:07, 3 August 2015 (UTC)
 * (EC) Both answers above are IMO excessively simplistic. The way USB works, the computer does know which port, and I believe even which port on a hub the device is connected to. Take a read of USB and USB hub for details. This is partially why on some OSes like Windows, the first time you plug certain devices particularly input devices in to a USB port (be it a port on the computer or a port on the hub), the device may take longer to start working, since Windows generally remembers previously connected devices and has everything set up mostly just needing to be re-enabled. If it's a port you haven't previously connected the device to, it often needs to set up drivers for the the device. This behaviour actually depends on whether the device has a serial number. If it does, Windows just reassociates the device if it has the same serial number. See for more explaination. On Windows, you can partially view which devices are connected to which port by opening Device Manager, changing "View" to "Devices by type" (you don't actually have to do this, but it makes things easier to see), expanding your computer, expanding whatever is next (probably Microsoft ACPI-Compliant System), expanding wherever your USB ports are (probably PCI Bus), and then expanding the one or more USB controllers. You will still need to properties on each device to see precisely which port on the root hub it's connected to. You may also want to properties on the USB controller and get a record of what controller it is. You could also use something like USBView which while intended for developers and only easily obtainable in compiled form from Microsoft by installing the ~300mb Debugging Tools  may make things a bit easier to visualise. Note that there may be some confusion due to changes in the port number or controller depending on what you plug in to where. For example, at least on my computer, a non super speed device plugged in to a USB3.0 port will receive a different port number from a SuperSpeed (USB 3.0) device (with appropriate cable of course). However these are consistent and predictable. If a Superspeed device is Port 1, a USB2.0 or earlier device will be port 3. Again on my computer, with a USB 2.0 port, a non high speed device will end up under the OpenHCD (OHCI) whereas a high speed device will be under the enhanced controller (EHCI). (With an Intel system I presume a non high speed device will probably be UHCI although I'm not sure if the drivers will call it that, see Host controller interface (USB, Firewire).) See also . Again I'm pretty sure this is consistent and predictable. It's true AFAIK that you can't easily predict a priori what physical port is what number in your computer. But presuming the computer never changes (or at least the motherboard and added USB controllers or hubs), you can I'm pretty sure store info you learn from testing and so reliably associate what the computer knows about what port a device is connected to with a physical port. If you add another hub, you can add this info as needed. Note that where the hub is connected on the computer should be something you can tell from  your earlier info, you just need to figure out which physical port on the hub correlated with which port. Some hubs have numbers but I have no idea how well these correlate with the internal port numbers of the hub. (Note that from my testing and AFAIK, the hub ports will just be the hub ports. So for example if you have a USB2.0 hub and plug a USB 1.1 device in to it, it will still be on the hub which will likely on EHCI, not on OHCI.) It may get a little more complicated if you add another controller. I'm not completely sure if how this will affect the root hub numbering. Hence my earlier suggestion to take a record of the controller. I'm believe there should be an ID which remain consistent, unless whoever made the controller device was really stupid. If someone wanted to mess with you, for any ports not hard wired to the motherboard. such as many front USB ports, they could probably open up the computer and change what's plugged in to where to confuse matters but that doesn't sound a likely problem for you. (Likewise, it may or may not be possible to change the firmware in such a way that you will mess with the numbering.) It's true that on probably all major OSes, a mount point will generally be consistent for the specific device, and not for the port because this makes much more sense for various reasons. But this doesn't mean it's impossible to do what you're attempting to do. Since the computer and OS basically know what port the device is plugged in to, you could I'm pretty sure make a program which will detect when devices are plugged in and either prevent or unmount a device as necessary, and re/mount it under the desired mount point depending on which port it's plugged in to.   have some related info and caveats under Linux that are probably worth considering on Windows. P.S. It's worth remembering with Intel High Definition Audio, the computer will usually know precisely which port you plug any audio device be it input and output device, and can generally dynamically reassign the port for either input or output. Thinking of ports as just interchangable wires is IMO often a little too simplistic with modern computers. Nil Einne (talk) 00:22, 4 August 2015 (UTC)
 * From a quick search, I found which may be able to do what you want. The help says "assign a letter from a list of new default letters, also dependend on many different criteria as the active user, drive type, type of connection (USB, FireWire), USB port, volume label, size, user and others". However it looks like it has no real GUI set-up so you will have to manually make a suitable ini and sorry I can't be bothered working it out for you. However the help does have a "Drive Letters by USB Port" section. Also "USBDLM is Freeware for private and educational (schools, colleges, universities) use only. The students shall outnumber all others". The cost of a licence is USD15 per user (after 30 days of use) if you don't fit in to any of the other categories. BTW, I also just noticed that the developer of USBDLM have a freeware modified version of Microsoft's USBView that may be easier to obtain . Nil Einne (talk) 00:39, 4 August 2015 (UTC)
 * Thanks for the information - it's been very helpful. I've managed to get to STORAGE_DEVICE_DESCRIPTOR, and I can get the device serial number, vendor ID, and 36 bytes of "bus specific property data".  I _think_ I need to get to SetupDiGetDeviceRegistryProperty, where the SPDRP_LOCATION_INFORMATION parameter awaits.  However, the route between them is not obvious.  Is there something in those 36 bytes that might help?  I've not been able to find a description of what they might be. Tevildo (talk) 18:53, 4 August 2015 (UTC)
 * If anyone is interested, the key is at .  See this page from MSDN.  The "bus specific property data" doesn't contain anything that isn't in the standard properties, unfortunately.  Tevildo (talk) 18:17, 5 August 2015 (UTC)

Typing English with Russian keyboard
When I forget to switch back to my English keyboard after writing Russian and I basically type English (with the English keyboard in my mind), but the output is gibberish in Russian, how is Google able to give correct English suggestions? For example, Google can decipher "руддщ" as "hello". So I think Google knows which letter is assigned to which key on different keyboards. Can someone explain this mechanism? --2.245.158.51 (talk) 23:08, 3 August 2015 (UTC)
 * The answer lies in keyboard layout and scancode. Do some reading and see if it makes sense. Vespine (talk) 03:27, 4 August 2015 (UTC)


 * Using Windows, type Alt+Shift, left key each to toggle keyboard layout per application. -- Hans Haase (有问题吗) 07:56, 4 August 2015 (UTC)


 * I think they just try the input as though it was typed on different layouts and assume the layout mapping which returns the most hits. There are way more hits for "hello" than for "руддщ", so it stands to reason that the person simply forgot to switch. (That's how tools which guess the proper encoding (codepage 866, windows-1251, KOI 8) work, too. You read in a string, transform it every which way, do a search in a wordlist, and the encoding which returns the most hits is the one the document is in.) Asmrulz (talk) 17:49, 4 August 2015 (UTC)