Closed LinuxHeki closed 9 months ago
I'm not sure this would belong in usb-device given that USB has no concept of an OS. There are only USB hosts and devices. A USB host may very well be an embedded device or custom hardware (e.g. not an OS).
While OSes do have subtle differences in how they do enumeration, I'm not sure this is something that should ever be relied on, as it would be subject to change without notice and be incredibly unreliable
Is it possible to implement OS detection with handshake?
Yes, as it is possible to do stupid things. However this much harder as getting drunk and falling from the balcony.
The first requirement, a first OS vendor providing "OS ID for USB", is the easy part. It only needs a single person at that OS vendor pitching the idea. Buzz words as new feature and unique selling point in the corperate environment will take it further.
Then it gets much harder. Other OS manufactures have to join the club of "USB with OS fragrance", do know that it wouldn't sell when they name it "We pissed on the USB standard so it has our odor". But hey, let's assume the club gets larger and managed to agree on "OS ID for USB" hand out.
Assume club of "USB with OS fragrance" does spend resources on some reference implementations. Next thing will be USB device manufactures wondering why they should make effort to make it possible to discriminate OSes. They, device manufactures, want to make products for the whole market.
@LinuxHeki I don't want to know what you were thinking when you posted the question. I'm asking for thinking before you post.
@ryan-summers and others who had to read this comment: I might have been wasting your valuable time. My hope is that you close this issue and that future simular feature requests get closed as a duplicate of this. That time can be spend better.
@stappersg putting aside the opinion that such comments are not appropriate, I'd remind that the question of the ticket is not about "why", it's about "how". There is a demand for OS detection, so it's ok to express curiosity about implementation.
USB enumeration process indeed looks differently depending on OS, and these differences can be used to create heuristics for OS detection. Is it possible to do this with this library? Well, probably not out of the box, one will have to augment USB driver for their MCU to gather more information about enumeration sequence.
USB enumeration process indeed looks differently depending on OS, and these differences can be used to create heuristics for OS detection. Is it possible to do this with this library? Well, probably not out of the box, one will have to augment USB driver for their MCU to gather more information about enumeration sequence.
I agree with many of the points @Disasm brings up here and want to provide a bit more context/clarity (and my own opinions).
Yes, I could have been more clear in my answer, but e.g. Ubuntu and Windows do have differences in how they perform enumeration processes (see https://github.com/rust-embedded-community/usb-device/issues/82 for a direct example of this), so you can theoretically create a method to detect that difference. However, @Disasm makes a great point here in that this is a heuristic. It can't be relied upon for anything important and would be subject to change without notice as the OS vendor may modify their USB enumeration sequencing.
Additionally, there may even be differences between different patches of the same OS vendor (e.g. differences between Windows 20H2 and Windows 21H1).
In regards to @stappersg
@ryan-summers and others who had to read this comment: I might have been wasting your valuable time. My hope is that you close this issue and that future simular feature requests get closed as a duplicate of this. That time can be spend better.
In my opinion, there should be nothing considered a "stupid question". Things are worth considering if someone has a need for it, and they wouldn't be posted here if they didn't have a need in the first place. As such, I try to apply the principal of charity even if my gut instinct goes against something. The original issue here is a valid question and it's worth addressing it as a serious request.
Given that there are no plans to implement this into usb-device
currently (and I don't foresee this as feasible either), I'm going to close this issue. Thanks for bringing up the idea though!
Is it possible to implement OS detection with handshake?