10 ms·
I turned my ThinkPad into a programmable USB device
- evanjrowley 3y agoI'm grateful for this extremely detailed article. Great quality here. The fact that this has been achieved gives me hope that a networkless Synergy / Mouse Without Borders setup might be possible using just a modified USB cable. That's great for people like me who need to operate multiple computers simultaneously.
- taskforcegemini 3y agothere is kvm switches (or just usb km without the video), but your suggestion sounds intriguing
- icodefuture 3y agoGreat article, thanks for sharing.
- rubatuga 3y agoWoah it's the stuff of dreams.
- freedomben 3y agoThis reminds me so much of the early internet hacker culture that it's actually triggering nostalgia. What a great write-up! When ESR talked about becoming a hacker (hacker in the Hacker News sense), this is the type of person he was talking about. The combination of curiosity, dedication, and technical ability is exceedingly rare, and majorly impressive. Thanks so much for sharing!
- tamimio 3y agoI quickly skimmed through it but great detailed article, and love the excessive use of emojis, not the typical boring wall of texts!
- aendruk 3y agoOne thing I’ve always wondered is why it’s not common to be able to use a laptop as a generic keyboard and monitor for another computer. For doing maintenance on a headless machine it feels silly to go buy a keyboard and monitor when my laptop already is those.
- deleted 3y ago[deleted]
- leonheld 3y agoEveryone uses ssh to do that.
- dingnuts 3y agoThat's a completely different use-case. SSH doesn't let me control the GUI on the remote And no, X11 forwarding is not what I mean either
- jeffbee 3y agoSo, you'll accept any solution, except the existing ones that work? XDMCP solves this exact issue. You use one device which becomes virtually an attached terminal of another device which is actually headless and with no input devices of its own. We've had this for 30+ years.
- pessimizer 3y agoNo, we already use the solutions that actually work, and are speculating why there isn't one with the simple, obvious user experience. Why shouldn't we?
- exe34 3y ago> XDMCP muh wayland
- pierat 3y ago
- actionfromafar 3y agoBeing able to emulate a USB block device is really neat! Talk about easy way to copy files to another computer. :)
- yonatan8070 3y agoA quick (and less intrusive) way to copy files quickly is by setting 2 machines to manual IP addresses and connecting them directly with an Ethernet cable, then using SMB to copy files from one to the other If not using SMB, and python installation can serve a directory over HTTP using `python -m http.server`
- planede 3y agoOr just netcat. Throw in tar if you copy a directory.
- erik 3y agoThis goes to an impressive level of depth. The ability to use a PC as a USB device opens up lots of fun possibilities. It's a little bit tragic that the required xDCI option is there in the hardware on this device, but it's not exposed and requires firmware hacking to access. The hardware is capable, but the vendor has just turned it off and locked away the controls.
- steelbrain 3y agoThis is really interesting. I've been researching some viable options like this. I have a beefy Network Attached Storage (NAS) server that I actively look for excuses to make use of. I have connected with some 40g and 10g interconnects for it across the house. I also have a PS5 & XBox that use USB hard-drives for additional storage. I looked into whether I could expose my NAS storage to PS5 & XBox. Turns out that it's possible! It's possible by mounting the NAS shares over iSCSI or NFS, and then emulating a USB storage device using the g_mass_storage module that exposes said storage to USB hosts. Besides time and cost, one major blocker for me right now is the bandwidth that such a system would provide. It's just not that big of an upgrade. Raspberry Pi very famously supports USB-OTG (similar/same as xDCI), but it only does so with USB 2.0 speeds, and so do all the other SBCs in that class that I found, except for one, RockPi4. RockPi has a Gigabit ethernet port, so if you max out ethernet, you can provide stable HDD speeds to both the PS5 & Xbox. It would be really interesting to explore a solution where you have the ability to plug in a custom PCIe network card (or an express card) that lets you go beyond 1gbe because then you can really saturate the USB 3.0 interface.
- chatmasta 3y agoRaspberry Pi 5 has a gigabit ethernet port, as do a number of other SBCs, like the NanoPi variants from FriendlyElec for example. In fact the NanoPi R6S has two 2.5G ethernet ports in addition to a 1 gigabit port.
- steelbrain 3y agoRaspberry Pi 5 still has a USB 2.0 OTG port. So the bottleneck is USB in that case
- moondev 3y agoI have a similar homelab setup and have been playing with USB over IP via https://www.virtualhere.com https://www.virtualhere.com It does require a client to talk to the server but seems to work pretty well. My thought is to setup a "thin USB client" on my desk that I can attach USB devices to which then are attached or switched to whatever metal or VM host I want in my lab.
- Topgamer7 3y ago> However, dealing with a Raspberry Pi is a hassle: plugging in the wires, booting the board, accessing the shell, etc Probably just could have configured USB OTG, so its powered by the device you plug in, enable shell, then scripted this. Then you can configure mounts over ssh, commands over ssh, probably even mount the device. That being said, I encourage people to try to understand their devices, read the kernel, etc. Its something I strive to continually improve. Lets fix our own shit :D.
- lima 3y agoThe whole point of the exercise is playing with USB OTG, and the Pi has only one OTG port, so you need another way to connect to it (been there, done that)
- k8svet 3y agoThe "Zero" variants of boards tend to allow power over the OTG port, so you can do some interesting things. (Of course, annoying if your powering-device resets power to it). Particularly, if I didn't suck at DTS/u-boot stuff, you could make a PiKVM for <$75. (You can get $10 1080p/60fps HDMI capture cards, you use the OTG port for kb/mouse). Still, even if you had to external power it, those little boards have pins for power in. It would still be cheap/fairly elegant. And or a USB-C Hub should power it, and give you a place to put more non-host usb devices like a usb-eth dongle. I would like to make one with some of the (Raspberry|Orange) Pi 3, but again, I've lost too much of my life to dts/u-boot stuff. BSP/mainline woes. It's just easier to be a software-only, cloud-machines-only guy and live minimally. This article was exciting because I'd love to imagine cheap old laptops being salvagable as little KVM instances, but it seems like OTG/xDCI is just not a priority.
- controversial97 3y agoThis reminds me of a thing from a few years ago, my vague memory is that it was by Travis Goodspeed. A smart TV would accept a firmware update from a file on a standard USB stick. The TV reads the file start to finish to check the digital signature then reads it again to update. A device that is pretending to be a USB storage device can send a manufacturer firmware file the first time then send your unofficial firmware after.
- zrail 3y agoNice. This is a class of error with the delightful acronym TOCTOU (Time of Check to Time of Use) which is present in an astonishing number of places. https://en.m.wikipedia.org/wiki/Time-of-check_to_time-of-use https://en.m.wikipedia.org/wiki/Time-of-check_to_time-of-use
- TeMPOraL 3y agoNo surprise, those are near-impossible to avoid. I mean, a simple: if(check(resource)) { use(resource); } is already vulnerable, unless you somehow make the entire piece of code run atomically.
- X-Cubed 3y agoOne approach is to copy the data to a location that you control first (eg: RAM) and perform both the check and the use of that data from the trusted location. That can be difficult though on embedded devices with constrained resources.
- crtasm 3y agoFor a firmware update: read it into memory or copy it to storage you control first.
- hypercube33 3y agoCorrect me if I'm wrong but I think that's how Gameboy carts show custom logos bypassing the Nintendo copyright check thing - one logo to pass the internal check and another for display.
- imhoguy 3y agoPity I can't do that with my AMD Ryzen ThinkPad.
- stragies 3y agoI have a Celeron N3350/Pentium N4200/Atom E3900 based system, that exposes an xDCI switch in the bios, and upon enabling it, I do get some other options, and upon bootup into linux a PCI device "USB controller: Intel Corporation Device 5aaa (rev 0b)" But the UDC device node is not showing up. So it seems I have to dig a bit further using inspiration from the OP
- lights0123 3y agoI was recently pleasantly surprised by a Linux utility that can list all UEFI variables stored in Hii and change them: https://github.com/linuxboot/uefisettings/ https://github.com/linuxboot/uefisettings/ Obviously can't bypass security settings like this laptop has, but it's useful for a few settings in my case.
- urbandw311er 3y agoWow - this guy REALLY wanted to use his xDCI capability and was not going to stop until he had done so!
- urbandw311er 3y agoWhy did they cripple this capability by hiding it in an undocumented and disabled BIOS setting?
- crote 3y agoIt's an extremely obscure feature for which the device lacks the hardware to do it properly (no VBUS switching), which is almost certainly untested. If I were designing a mass-market product, I would disable it too. They got the BIOS from a 3rd party vendor, disabling it by default and hiding the setting was probably the easiest way to prevent anyone from accidentally trying to use it.
- zokier 3y agoIts under "advanced" tab in BIOS. How many people accidentally stumble there? And how many of those people will have problems with it? And of the tiny number of people who end up enabling it and have problems, how many will then complain to Lenovo? That seems like really marginal case! Especially when it needs also things to happen from OS side too, so just flipping the flag in BIOS in itself shouldn't do much. How much trouble would it have been to add warning "this is not supported, use at own risk"?
- luxuryballs 3y agoSo does this mean I could essentially copy and paste between two machines by just feeding standard USB keyboard input into one of them?
- lathiat 3y agoI was looking into similar recently just wanting to do 10Gbps between two USB-C machines over USB with just a USB-C cable. Unfortunately most Ryzen boards still don't have Thunderbolt (which supports this natively and easily). And "dual role" USB controllers were quite uncommon (or as this article details, possible but not supported) until USB 3.2/4.0 - and even then it seems a bit hit and miss. It's totally crazy to me it's not easier to network two machines with a USB-C cable (without Thunderbolt). I also love the part about the lock bit being cleared after a suspend, that seems to be such a common issue.. super common way to get SATA devices out of the state preventing secure erase for example.
- explodingwaffle 3y agoGreat article. You would hope this feature was more readily exposed on USB-C laptops where it makes a bit more sense… oh well.
- zzz999 3y agoYou can do that with cheap ESP boards worth about $3
- JoBrad 3y agoYes, but now you can do it with a laptop!
- zzz999 3y agoSure could, but it is almost the most inefficient way... I guess it works for experimentation
- extraduder_ire 3y agoDo you mean by wiring up the GPIO, or via their USB port? Any esp 8266/32 I have used has only had a cheap serial adapter on the USB port.
- zzz999 3y agoYou can get USB otg on esp... Like the s2... I did a rubber ducky using those
- PennRobotics 3y agoI wonder if Lenovo is using this as a path to debugging one ThinkPad using another: https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/secure-coding/intel-debug-technology.html https://www.intel.com/content/www/us/en/developer/articles/t... --- Update: probably. https://www.youtube.com/watch?v=ExUvQa_jB7c https://www.youtube.com/watch?v=ExUvQa_jB7c (Debugging Intel Firmware using DCI & USB 3 0)
- mrmuagi 3y agoI'm actually trying to do this on a Raspberry Pi right now to emulate a HDI. There are a lot of existing libraries that do this. I needed to do this because the native SendMessage/PostMessage ways to send keystrokes to a Windows process break down when you need to send modifier keys -- I needed to send ":" but I could only send ";". I tried endlessly to send the "shift" modifier key to no avail. I actually considered directly writing to memory to "trick" the program to think certain keys are pressed (but this doesn't work for emulating actual typing input), or hook into functions with a dll injection and interleave fake input somehow.
- seba_dos1 3y agoI'm somewhat irrationally irked by the use of the word "emulated". It does not "emulate" a USB device, it becomes one! This mechanism is exactly what all your gadgets with Linux on-board use to be USB devices.
- Log_out_ 3y agoImagine a world were all kinds of platforms could be add hoc merged into one large "kernel" that allows to combine all sorts of hardware into one huge device. Old laptops, old phones, it's all merged into one huge abomination.