7 ms·
Recently I tried out some USB temperature sensors. They present as both a proprietary temperature sensor and also as a USB keyboard. In the event you don't have
by bdamm 8y ago
Recently I tried out some USB temperature sensors. They present as both a proprietary temperature sensor and also as a USB keyboard. In the event you don't have a driver for the sensor, you can still get your readings by toggling the caps lock which sends a "turn on caps lock lamp" signal to the "keyboard", which responds by "typing" the temperature data.
I'd rather this device presented itself as a drive containing various virtual files that contain temperature data in them, but the cat's out of the bag, so to speak.
- jpindar 8y agoEeewww. Why not just make it a virtual com port, which most computers already have drivers for?
- bsder 8y agoBecause Windows, the most popular operating system on the planet, didn't have VCOM drivers by default until Windows 10. This is why everybody tries to piggyback on being a USB HID device.
- taneq 8y agoIt did for a few different devices, they could have mimicked one of those. Source: Have plugged several brands of USB-to-COM adapter in to Win 7 / 8.1 and they've "just worked".
- bsder 8y agoSomebody, somewhere had to install a driver. And, because you could never count on it, you can't design to it. Now, since most things use a Prolific chip, you only have to install the driver for one device and you pick up a ton of them. But it has to be installed by somebody, and that means all of the silliness that goes along with Windows driver installation.
- oarsinsync 8y agoFTDI chips have their driver deployed by default on most Windows, Mac and Linux installs. It's nice being able to buy a USB/serial cable and it just work, without needing to deploy any drivers at all. Check it out!
- swish_bob 8y agoHad to install FTDI drivers on (an admittedly old) Windows laptop 3 weeks ago before I could use it to talk to the Cisco gear I was reconfiguring ...
- InitialLastName 8y agoIIRC the FTDI chips use a non-standard com driver on Win 7. IF you want your device (with your VID and PID) to show up as a serial port, you need to associate your device with the usbserial driver, which at the very least requires a custom .inf.
- deleted 8y ago[deleted]
- netsharc 8y agoThe keyboard trick is quite a hack, but creative. At the same time afaik most barcode scanners also act as keyboards, you scan a number, it "types in" those numbers. I can't see how the filesystem hack would work, if the OS has the drive mounted, it would cache files in memory, and not notice the file contents changing. You can't even modify the metadata, because most of that might also be in memory.
- the8472 8y agoEmulate a MTP device (often used by cameras) and mount with a fuse driver. Since the content on the remote device can change the driver shouldn't be caching it.
- evan_ 8y agoat that point you might as well just use the real drivers.
- geofft 8y agoOr emulate a network, generate a DHCP response for your favorite /31 and don't send a router, and point a public domain name at the other address in that /31.
- voltagex_ 8y agoCan you elaborate? I understand the concept of RNDIS or CDC devices, but if you've sent an IP address only without a router, how is any traffic going to make it back to the other IP in that subnet? I figure it will go back over the default route, but how are you in control of the traffic itself?
- deleted 8y ago[deleted]
- oarsinsync 8y agoThe subnet mask determines the size of the connected network, which is in itself a route in your routing table. It's the same mechanism used to reach your router. Subnet-local / connected routes are routes in themselves. Routers let you leave your subnet.
- conistonwater 8y agoThat's kind of ingenious, but is sending temperature data over USB really such a hard problem in the first place? I'm not really familiar with the USB protocol.
- taneq 8y agoUSB doesn't work without a driver and sometimes you don't want to (or can't) install a driver. This sounds like the kind of hack that a clever (but arguably unwise) engineer would shove in to help them remotely troubleshoot a device. "Sensor not detected? OK, open up Notepad and hit Caps Lock three times quickly. Did some text appear? The sensor is fine, the problem is with your computer."
- robertAngst 8y agowhy is this unwise?
- darkpuma 8y agoHe failed to consider that people on hacker news would tut disapprovingly at his hack.
- taneq 8y agoBecause it could lead to all manner of weirdness that the user doesn't expect. Imagine someone trying to type some data into a spreadsheet and every time they hit the capslock key a strange text string appears in the cell, maybe leading to data corruption. Or even worse, it happens in some program where the typed characters are interpreted as hotkeys and instantly perform some unknown combination of actions which the user may or may not even know occurred.
- megous 8y agoIt's not that hard to pick some standard class, like CDC and have a userspace app that uses it just like a serial device. You can get info on which serial device to use via sysfs on Linux. The rest is just making up a serial protocol. No need for a special driver.
- novaleaf 8y agofunny thing: my UPS also presents as a keyboard. and made my computer kept waking up from sleep at random intervals. Very hard to troubleshoot.
- deleted 8y ago[deleted]
- noir_lord 8y agoI've use those as well, bit of a pain to work with in non keyboard mode but they are at least accurate enough.
- russdill 8y agoYou can actually use the USB hid class to present pretty much any data in any way you want. The reason they present as a keyboard is probably so they don't need to worry about drivers. With newer versions of windows I think you can work with such hid devices without special drivers though.
- mcv 8y agoSeems like the core problem is a single standard for many different kinds of devices, which makes it possible for devices to act totally different from what it physically appears to be. Maybe we should have stuck to PS/2 keyboards after all.