Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Thursday, August 26, 2010

USB devices troubleshooting

Source Danke vielmals, Uwe Sieber!
USB drive not working stable
When a USB drive makes problem on one computer only then an updated mainboard/chipset driver may help.
If it doesn't help then it may be just incompatible with the computer's USB ports - that's not unusual. Therefore it's helpful to have an additional USB PCI card as alternative in the computer, best with NEC chip.
Cheap USB extension cables may cause problems too. The thinner and longer the higher the risk for problems. The plugs wear out in time.
USB ports on front of the computer are more problematic because the USB is leaded by a cable thru the computer case which is full of interferences. Furthermore the port a mechanically stressed, so the usually fail sooner or later.
Other attached USB devices may interfere, usually such ones that don't use a default Windows driver and which permanently transfer data, such as web cams.
Cheap USB hubs die slowly. First symptoms are disappearing devices and communication freezes.
If a USB device has been detected as 'unknown device' once it might be necessary to delete it in the device manager and replug it then.
Another try is a complete USB device clearing by Microsoft DEVCON and the RenewUSB.bat from
A cleanup can be done manually too. Put the following two lines into Notepad and save them as DevManager.CMD:
Started thru this DevManager.CMD the Windows device manager shows non present devices too if you check "View" -> "Show hidden devices". Since Vista this must be started "As Administrator", otherwise it has no effect.
Under "Disk drives", devices shown with a light gray icon are non present. Just delete them. Same procedure under "USB Controlers" and "Storage volumes". There may be a lot of them... My commandline tool DriveCleanup does it for all currently non present storage volumes and USB drives.
Microsoft has set up a page for General USB troubleshooting in Windows XP
To have DEVMGR_SHOW_NONPRESENT_DEVICES=1 set permanently, download and doubleclick this file: DevMgr_Show_1.reg. After next logon it takes effect.
It also sets DEVMGR_SHOW_DETAILS=1 to get the "Details" tab in the device's properies dialog under XP-SP1.
Data loss when certain occupancy level reached
When a USB flash drive causes errors when it reaches a certain occupancy level then it's probably a fake which has a fraction of the promised capacity only.
Written data then either overwrites data on other addresses or are just lost in space. Therefore formating with NTFS fails while FAT works because the NTFS file system is written into the middle of the drive. You can check suspicious and new drives by means of the free tool H2TestW 1.4 made by the German computer magazine c't.
If a drive is a fake then you can create a small partition to protect the non existing range from being used.
Windows 2000, XP and higher do not support creating partitions on removable drives. So either turn the drive into a USB harddrive or do it under Linux or by means of the Ranish Partition Manager.
Anyone knows a free tool to create partition on removable drives under Windows XP?
Format a USB drive
If the Windows Explorer fails to format a removable USB drive then one of these tools may help (for removable drives only):
To test if there is any access to the drive, you can use Hex Workshop.
'Disk' -> 'Open Drive...'
Select here the drive by its size. Stop here if you are not sure!
Once opened it shows the content of sector 0 where you find the partition table on harddisks. On removable drive there can be a partition table or a boot sector ('super floppy').
The format tool mentioned above write a partition table. XP creates super floppies on new medias.
To give a disk a complete new start, just overwrite sector 0 with zeros: Select all using the mouse, click '&', OK, save. Now you can go to the disk management console to partition and/or format the drive again.
FAT32 on drives greater than 32 GB
Under XP and higher Microsoft has blocked formating drives larger than 32 GB with FAT32 without a good reason. But for devices with a standalone function as image tanks or MP3 players FAT32 is essential - they don't work with NTFS formatted drives.
The german computer magazine c't offers a format tool:
H2Format. But it works on unformatted partitions only. 
To prepare a drive, go to the Disk Management, delete the partition, create a new one and select 'Do not format'. Then use H2Format to write a FAT32 file system - usage is similar to the FORMAT.EXE. Sample:
h2format u:
It's very fast because it does nothing else then writing an empty FAT32 file system.
Another FAT32 formatting tool is Fat32Formatter. Under Linux there is the tool "MakeDosFileSystem", short MKDOSFS. 
There is a Windows port:
A modern BIOS sees USB drives (at least a single one), so you can deal with them under pure MS-DOS too. Or without any operating system: Get the great Ranish Partition Manager, unzip it, start the PART.EXE under Windows. It detects that it's running under Windows and offers the option 'Copy PART.EXE and update boot sector on A:'. This writes the program to a floppy in drive A: that you can boot from then. It does not contain an operating system but it's bootable.
On flash drive only the first partition works 
change in the text for your convenience the character Ampersand instead of & 
Nearly all USB flash drives pretend to have a removable media (even it's a lie), so Windows detects them as 'removable'. On drives with a removable media Windows 2000 and higher supports only one partition.
Finally it's a single bit in the device's device descriptor, the removable media bit (RMB). If you take away the RMB then Windows sees the drive as 'local disk' and multiple partitions work.
The Removable Media Bit can be changed either in the drive's hardware or by a Windows filter driver.
Changing in the hardware works with some flash drives by means of the tool Lexar BootIt.
Flash drives which has been successfully turned into fixed drives:
  • Corsair Flash Voyager 8 GB
  • Corsair Flash Voyager 16 GB
  • Corsair Flash Voyager GT 4 GB (VID_1B1C&PID_1A90)
  • Corsair Flash Voyager GT 16 GB
  • Corsair Flash Survivor 32GB
  • OCZ Rally2 32 GB
  • OCZ Rally2 Turbo 8 GB
  • Buffalo Firestixx 1 GB (RUF2-S)
  • Buffalo Super High Speed USB Flash Type R 8 GB
  • Super Talent Pico-C Chrom 8GB
  • Intenso USB Drive 8 GB Slim Line
  • Sony Tiny Vault 2GB
  • LG USB Drive 2 GB (UB2GVMS01)
  • Ativa 325-300 16GB
  • PQI Intelligent Drive i820 4 GB (8 GB does not!)
  • Powerram mini Pro (16GB)
  • Verbatim 4 GB Store' n Go
All these flash drives must have something in common, probably the vendor of its controller chip. Since the vendor ID is obviousely freely configurable by the OEM, some drives must be opened to give us a look at the chip... Please drop me a note if you have more, but please only drives with a known brand which can be easily been bought. Listing noname drives here is useless.
A filter driver for removing the RMB has been made by Hitachi for their Microdrives (Compatct Flash cards with a mini harddrive):
By modifying the included INF file the filter driver can be used with any other 'removable' drive.
For the device detection there are the lines in section [cfadisk_device]:
%Microdrive_devdesc%= cfadisk_install,IDE\DiskIBM-DSCM-11000_SC2IC801
is the device ID of one of the supported Microdrives.
In analogy to these lines we add one line for each 'removable' USB drive we want to turn into a USB hard drive. The ID is found in the Windows device management: Expand 'Disk drives', right click your USB drive, select Properties. On the tab "Details" under XP the item "Device instance ID" is already selected. Click on the ID in the List and press Ctrl+C, this copies the ID into the Windows Clipboard and can be pasted somewhere else with Ctrl+V.
XP up to SP1 shows the tab "Details" only when the environment variable DEVMGR_SHOW_DETAILS=1 is set:
DevMgr_Show_1.reg download and doubleclick the file, then relogon to take effect.
We need the fat part:
%Microdrive_devdesc% = cfadisk_install,USBSTOR\DISK&VEN_LEXAR&PROD_JUMPDRIVE&REV_1.30
Or much more simple the universal way:
%Microdrive_devdesc% = cfadisk_install,USBSTOR\GenDisk
In the last line of the INF file we change "Hitachi Microdrive" into something nice as "RemovableToFixed".
In the device manager again right-click the USB drive, "Update driver...", then "No, not this time" - Next - "Install from a list or..." - Next - "Don't search." - Next - "Have Disk" - browse to the INF file here. Now "RemovableToFixed" should be in the list - Next - Confirm the two warnings - Finish.
Now the drive is redetected, actually as USB hard drive. The drive can be partitioned, the policy "Optimize for performance" indeed activates a write cache on FAT formatted drives and Windows will create the beloved folder "System Volume Information"...
My tries to automat the installtion by means of Microsoft DEVCON did not succeed.
The filter drive can be removed by deleting the drive in the Windows Device Manager. After reattaching the drive its drivers are installed again, but not the filter driver.
Remove non removable drives from the "Safely remove hardware" list
Internal card readers of desktop PCs are usually USB devices. The USB standards define no mechanism which allowes a device to say "I'm internal and not removable". Therefore internal USB card readers are listed in the "Safely remove hardware" facility.
There are also SATA drivers which pretend their internal drives being removable. As far as known devices are shown in the "Safely remove hardware" list if they are marked as removable and not as "surprise removal is ok".
These are bit coded flags:
From cfgmgr32.h:
#define CM_DEVCAP_REMOVABLE         (0x00000004)
The device capabilities are found in the registry in a value named 'Capabilities' under (sample for a USB drive):
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_090c&Pid_1000\A740000000000097 If you take away 4 from the value or add 80h and then refresh the safe removal dialog by toggeling the checkbox, then the drive is gone.
But the value is reset when you attach the drive for the next time or on next boot. This is hard coded into the driver and read each time the drive is loaded. If you export the modified value into a reg file then you can silently load it on startup like this:
regedit /s hidecardreader.reg
But you need admin previleges to write this value. Under Vista even an admin is not allowed to change the value offhand.
The device instance id string of your drive (this USB\Vid_090c&Pid_1000\A740000000000097 thing) is found in the properties of the drive in the device manager on the 'Details' tab. But XP shows the tab "Details" only when the environment variable DEVMGR_SHOW_DETAILS=1 is set:
DevMgr_Show_1.reg download and doubleclick the file, then relogon to take effect.
On the tab "Details" under XP the item "Device instance ID" is already selected. Click on the ID in the List and press Ctrl+C, this copies the ID into the Windows Clipboard and can be pasted somewhere else with Ctrl+V.
Meanwhile I've added a function to do this to my USB drive letter manager.
Still, you have to determine the device id, but everything else is left to the USBDLM service.
In the USBDLM.INI set for instance for a USB drive

No comments: