views:

9974

answers:

8

I recently was given a small USB flash drive as an advertising gimmick. When I plug it in, only one drive appears: a CD drive with 42kb used (just an autorun.inf file which launches the manufacturer's website). I know U3 drives also appear as CD drives, but their uninstall utility only works for their own drives.

How can I make it appear as a USB drive instead? Conversely, if I wanted to do the same thing for myself, how would I make it appear as a CD drive?

I'm sure it can be done programmatically, or else the uninstall program wouldn't work.

A: 

This is probably due to the drivers for the actual drive its self.

Tom Anderson
You're saying it's hopeless unless I write my own drivers?
Michael Myers
"probably"
Tom Anderson
mmm, not what I wanted to hear. Ah well, I'll accept this if nothing else shows up.
Michael Myers
+2  A: 

This is done in hardware. The device identifies as a composite device containing two children - one for the CD drive and one for the removable storage drive.

On Freund
Unfortunately, there isn't even a removable storage drive shown.
Michael Myers
By "hardware", do you mean the actual circuitry or the firmware?
Michael Myers
Firmware and/or drivers.
Mihai Limbășan
Drivers usually don't play a part here since the generic OS storage drivers are used (you don't have to install anything to use U3 drives).
On Freund
They can very much play a part - for example most composite devices (think 3G/HDSPA stick which contains a "CD drive" with the software) aren't fully recognized by the OS until they install an USB enumerator for their IDs.
Mihai Limbășan
The 3G/HDSPA devices I've seen had their CD drive working with no installation. The drivers were needed to enable the actual modem functionality. I've never encountered any device that requires driver installation to enable its 'virtual CD" function, and I work with new devices on a daily basis.
On Freund
"autoinstall" feature does not require any additional drivers as On Freund correctly stated. The drivers are needed for CDC class which does not implemented on Windows and possible for additional clever tasks, but not for CD itself.
Ilya
Many USB devices, such as the 3G modems, implement some very very ugly USB trickery in order to work with multiple configurations in Windows. USB allows fallback configurations to be chosen if the host does not understand a previous configuration, but Windows doesn't really follow the specification here. This makes the Linux support for the devices somewhat interesting - they usually implement a SCSI endpoint or HID device which the installed driver writes to in order for the device to switch personality. In the case of USB disks, the hardware gives a composite device with two mass storage pts
Yann Ramin
A: 

Try plugging it into a Linux box to see if you can get more direct access to the hardware.

Kibbee
I dual-boot, so that's definitely an option. Do you have any further tips?
Michael Myers
lsusb and tailing dmesg and /var/log/messages come to mind :) That will give you all its claimed USB IDs.
Mihai Limbășan
A: 

Ok, there is 2 questions here :

1) How can I make it appear as a USB drive instead?

It's depends on device itself. I can see 2 options.

  • Device support writing, but represent itself as CDROM and read only. In this case you just need to tweak the device descriptor and you will get working storage device.
  • Device does not implement write and nothing can be done.

By tweaking device descriptor i mean filter driver that will receive device descriptor and will pass a modified one to Windows. Writing filter driver is not very hard and you can find an examples of filter driver in Driver development Kit. A basic understanding of USB protocol will be needed as well.

2) Conversely, if I wanted to do the same thing for myself, how would I make it appear as a CD drive?

Basically same, filter driver that will change the device descriptor to be recognized by CDROM device, but in additional once Windows will recognize CDROM it will send additional SCSI commands to device. Ideally device will just return unsupported command and it's OK, but from my experience most devices are not generic enough and the behavior will be undefined. In this case you will need additional filter driver that will catch this additional commands and will complete the commands without actually sending them to device.

P.S
My answer assume that you don't have access to device firmware, If you do have access to firmware it's really easy to accomplish by modifying device descriptor and making sure that not supported commands are handled correctly.

P.P.S
I don't provide any links to resources since i don't think that practically you going to implement this. If I'm wrong let me know and i will provide relevant resources. Ok one link with general information

Ilya
Windows will load different drivers depending on the storage type (Disk.sys and its relevant filters for USB driver, and cdrom.sys and its relevant filters for a CD). I'm not sure that fooling the OS into loading a different driver stack is a good idea.
On Freund
I did not tested it. But based on my long experience with USB and device drivers i can't see any reason why it's might not work. Any way it's the only way to do it without changing the hardware ...
Ilya
It isn't really related to USB layer but to the storage layer. I'm not sure that DISK.sys (not to mention any 3rd party filters it might have on that machine) will gracefully handle devices that should be handled by CDROM.sys
On Freund
There is almost no differences on device side between regular usb flash disk or usb cdrom, filter i suggest is below disk.sys or cdrom.sys layer i,e at usb layer, this filter should eliminate this difference again hard to argue without testing, but can't see how it can affect something ...
Ilya
As I said, disk.sys and cdrom.sys have different filters (some of them could be 3rd party) that might rely on specific behavior. Of course you can have a PnP filter to change device identification (or just create an INF file for that device), but you can't guarantee how these filters will behave.
On Freund
Specific behavior of usb based cdrom device can be mimic using filter drivers on usb layer, properly designed filter driver at disk layer will not notice the change. Bad written filter probably will crash even if real usb device will misbehave.
Ilya
And most of them (real usb devices) are misbehave :)
Ilya
A: 

Creepy! I just had the same question asked by my friend yesterday!

Anyway, after a little search in google (I can't remember the keywords) we found that to turn the USB into a CD ROM you have to write an ISO9660 file system. I think you can only do that on Linux. However, this makes it read-only. There is also an idea of writing a UDF type thingy to make it writable, but we didn't looked it further.

As for making it into a flash, I think simply formating it with a tool (Partition Magic) will do the job (assuming it will recognize it as a USB device and not as a CD ROM drive).

In general, I think what you are looking for is how to format a USB Drive as a CD-ROM and vise-versa.

As for programmatically... I'll bookmark this question, since I have no idea. ;)

pek
file system have little relation to the device itself. As i explained in my post the device characteristics should be changed in order to convert the device from one type to another, file system is much higher level ...
Ilya
A: 

I'm having the same problem, kinda. I left my flash drive unused for several weaks and when i plugged it in my PC it reads as a cdrom device... Thus I can't format it to return it to its original state. How should i proceed? I'm using vista but had the same problem on XP.

There is a specific driver on the USB that might give some light: USB Disk 30X USB Device. I'd like to understand what happened. How come its all of a sudden being recognized as a CDROM?

Ah, unlike mmyers there is no data stored.

A: 

Hey guy, I have done with my usb FD serveral times to make it into 2 devices CD and usb. The only thing you must do is download chipgenius then run it,wait for it to identify your usb then go to http://www.flashboot.ru/index.php?name=Files search your usb firmware tool. If you get the correct one i'm sure there will be no problem. I had done that and turned my usb into hiren boot cdrom, and when boot from bios you no longer choose your usb name but choose usb-cdrom option.

Interesting, but frankly the .ru domain scares me. Is there any other alternative?
Michael Myers
A: 

Any update on this ?

michael
Not that I know of, sadly.
Michael Myers