PORTS Forum
Ports and Interfaces => USB => Topic started by: Adrien Decostre on December 18, 2015, 05:29:39 am
-
Dear all,
I am working on a Linux mass storage device implementation and I am wondering if it is possible for the USB device to identify the host operating system during enumeration. Is such mechanism defined in the USB standard?
More specifically, I would like the disk driver loaded by the usb mass storage device to be specific to the host operating system. Would it also be possible to have the mass storage device having multiple LUNs and enabling or disabling each LUN based on the host OS?
Thanks a lot in advance for any help or any advise,
Adrien
-
The USB specifications say nothing at all about OSes. Why do you need a different driver depending on OS? Maybe there is a different approach to accomplish the same thing.
-
Hello Jan,
Thanks a lot for your quick answer.
The goal would be to provide a mass storage hosting specific Linux applications on Linux and a mass storage hosting specific Windows applications on Windows.
I was also thinking on having a mass storage with 2 LUNs: one valid for Linux and another valid for Windows. I would then suppose that the host would select the valid LUN, right?
Thanks a lot in advance for any help or suggestion.
Best regards
-
I believe Linux supports all Windows file systems, so I don't know how one would make a LUN that is valid for only one OS.
However, you could provide a partition or directory for each OS. Both might be visible, but for example, if you name the directories Windows and Linux, their functions would be clear.
How to manage this may also depend on whether you are planning to run the applications from the drive or just install the applications from the USB drive onto an internal drive.
You could write an application to hide a partition in Windows:
http://www.sevenforums.com/general-discussion/11623-how-do-i-hide-specific-drives-partitions-windows-7-a.html
And use autorun to run it.
Possibly you can do similar in Linux.
But this might be more complexity than you need.
-
Hello Jan,
Thanks a lot for this suggestion. This seems a very good idea.
I will give it a try.
Best regards
-
In general, its a bad idea for the device to try to work out what the host is.
If you wrote a host driver, it could send the device a message telling it to enable or disable features. I've done this sort of thing, we had trouble with one particular host. I added a vendor specific command to the device, the host OSs added drivers to send that vendor specific command.
The vendor specific command did not identify the host, but directed the device to do the appropriate thing. In this case the problem was with power, so the command told the device to use more or less power as necessary. The command was general enough it solved the original problem and found a whole host of other uses. The device still doesn't care what OS the host is running, it just does as its told.
Writing a host driver is not a trivial exercise, particularly on Windows.