2
votes

I am programming a USB mass storage device using the Atmel AVR set of libraries making use of host HID drivers only. I would like to have some specific behavior based on if the device is plugged into a Windows machine vs a Linux (let's just say Debian based) machine. I've searched the API and haven't found anything that seems to have this capability.

Is there a specific function that allows me to detect the connected OS? Or, is there a specific set of behavior I can key in on to at least deduce the connected OS?

1
Are you developing your own drivers on the host side, or rely on system standard ones (e.g. HID)? With your own driver you could incorporate the OS info into the protocol, but in general case there is no way to guess the host's OS. But one can theorize on this of course (e.g. ix.cs.uoregon.edu/~butler/pubs/sadfe11.pdf)Archie
@Archie Using HID, thanks for helping me clarify. That resource may be very useful - looking into it nowKDEx

1 Answers

2
votes

There is no standard way according to the USB-Spec to get the type of the host system.

And usually you do not want your device to react os dependent. Normally you want your device spec-conform so that any device with correct USB-Implementation can connect with it.

Otherwise there would be so many different OS's to consider. e.g. dozends of Linux flavours.

However, some security reserchers presented (or did they found such things in the wild?) attack scenarios with badusb devices that detect the host OS by some timing and protocoll uniquenesses to trigger slighly focused attacks.

So you may search in this direction.

But this approach is more like recognizing a specific person just by looking at his foot prints. The person may update its shoes at any time...