Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows PC as a USB slave to emulate a thumbdrive

I need to create a application that will allow a Windows PC (XP/Vista) to emulate a thumbdrive. That is, when the PC is plugged into either another Windows system, or in this case, a piece of hardware that allows for USB thumbdrives to be plugged in, a folder on the computer looks like a giant thumbdrive. Any thoughts on where a guy would start to investigate this?

Update (more specific description): I need to connect my PC to one of the newer multifuction devices that support scanning to a USB thumbdrive that is inserted into the front of the device. These units do not support WIA or TWAIN via the rear USB connector that you'd typically use for connectivity to a PC.

like image 578
Douglas Anderson Avatar asked Mar 25 '09 15:03

Douglas Anderson


3 Answers

Most USB controllers in regular pc's dont have the possibility to function as an USB slave. So I'd start with investigating what kind of hardware you're going to use.

Another way to go: there are USB Link cables to link up 2 pc's over USB, maybe that's usable for you?

like image 163
thijs Avatar answered Sep 23 '22 16:09

thijs


You cannot do this in an application. At the lowest level, the USB ports on your computer are controlled by an Host Controller Interface. This chip will manage up to 127 slave USB devices. You would need to seriously reprogram this chip before it implements the slave side of the USB protocol. Of course, at that point any USB hub in your PC will break down - those 8 USB ports you probably have are usually implemented by 2 smart USB hubs connecting to both USB1 and USB2 host controllers. Next, your USB keyboard and mouse will stop working.

like image 40
MSalters Avatar answered Sep 26 '22 16:09

MSalters


Take an MCU with two Slave USBs. Write a simple frimware which makes one USB act as a Special Device Class and wait until PC on this USB provides mandatory data (including Device Class, of course) for the other USB. Write a PC program which connects to the Special Device (your MCU), uploads Mass Storage Device Class and redirects I/O to a dedicated partition. The other USB on the MCU will become an emulated Mass Storage Device.

Some of those code can be taken from Linux.

like image 37
user5369592 Avatar answered Sep 24 '22 16:09

user5369592