Live data from Hacker News

Ask HN: Advice for creating a USB device linking 2 computers

news.ycombinator.com

21–30 of 46 posts

Re: Ask HN: Advice for creating a USB device linking 2 computers

#22
post #8

Earlier quoted context omitted.

I'm confused, why do you want hardware and what do you want the hardware to do? And, why not use a USB keyboard? You could use an rpi pico. It has a usb port and there is a software hack to bit bang a second usb port, iirc.

I am wondering if connecting over USB is an XY problem.

To try and clarify a bit: I am essentially trying to have a KM (KVM without the V) over USB.

To go one step higher, I am trying to control a mac mini from the keyboard of a macBook.

Re: Ask HN: Advice for creating a USB device linking 2 computers

#23

I don't think you can tackle this purely from a hardware side. If you want to send input from the laptop to another system, there's no kind of USB profile available to collect input from a system. You're going to need software on the laptop to gather the input. That seems necessary. You're not going to invent a purely hardware based solution here. Given that, I'd abandon your starting requirement of needing two usb d…

That's absolutely fair, and I am fine with writing software for both computers. However, I need this software to not go via the network at all.

Re: Ask HN: Advice for creating a USB device linking 2 computers

#24
post #7

Easy way is probably two usb-serial dongles and a null modem, if you don't need huge amounts of throughput.

Thanks for that, that's an interesting thought. I am trying to think about the security aspect. If the receiving device (mac mini) is infected with malware, can it infect the macBook through the serial port?

Re: Ask HN: Advice for creating a USB device linking 2 computers

#25

I don't think you can tackle this purely from a hardware side. If you want to send input from the laptop to another system, there's no kind of USB profile available to collect input from a system. You're going to need software on the laptop to gather the input. That seems necessary. You're not going to invent a purely hardware based solution here. Given that, I'd abandon your starting requirement of needing two usb d…

That's absolutely fair, and I am fine with writing software for both computers. However, I need this software to not go via the network at all.

I'd still 100% recommend using ethernet, with two usbethernet adapters on each end and a cable in-between to direct link the two. It's the most standard easiest to acquire way to link two computers, and it doesn't require any other network to work. Using more bespoke hardware is only going to make this more difficult. Using usbserial would also be acceptable I suppose, and require a little less configuration effort, but adapting software to use this is going to be much harder when the existing software is so IP oriented. Whatever the case, having off the shelf connectivity seems like such a win, and I continue to dis-recommend building anything yourself: this is/ought be mostly a software problem.

The one carve out I'd make: if you want to minimize the configuration at the target device, it ought be possible to make a rpi0 device that outputs a usb-gadget keyboard. Continue using one of these IP based software systems to send input to the rpi0, then usb-gadget it out to the target device.

The btkbdd project also might be up your alley: if the target system has bluetooth or can have a (very cheap!) usbbluetooth adapter added, making the laptop just send a bluetooth HID to the other device is probably one of the lowest configuration most standard paths available for this work.

Re: Ask HN: Advice for creating a USB device linking 2 computers

#26

Earlier quoted context omitted.

That's absolutely fair, and I am fine with writing software for both computers. However, I need this software to not go via the network at all.

I'd still 100% recommend using ethernet, with two usb ethernet adapters on each end and a cable in-between to direct link the two. It's the most standard easiest to acquire way to link two computers, and it doesn't require any other network to work. Using more bespoke hardware is only going to make this more difficult. Using usb serial would also be acceptable I suppose, and require a little less configuration effort…

Thanks for your thoughts. That all sound fair.

I am fine with having quite a bit of configuration on the target device (I am fine with configuration on both sides).

> it ought be possible to make a rpi0 device that outputs a usb-gadget keyboard

I like very much the idea of being able to make the host side (macBook) appear as a usb-gadget keyboard. That way I would just need to plug a single usb cable between the 2 computers. Could you give me a few pointers to get started, to do this on macOS?

Re: Ask HN: Advice for creating a USB device linking 2 computers

#28
The destination computer reads a file (of keystrokes) on a USB at a mount point, like every few seconds. The source computer writes to the same file.

After each newline, you are the "device" in the middle that unplugs the USB from the source computer and plugs it in to the destination computer.

Now we want to automate the middle, but without networking. How to do that?

See also Logitech Flow keyboard (and mouse). After each batch of commands, communicate via the shared clipboard.

Re: Ask HN: Advice for creating a USB device linking 2 computers

#29
post #8

Earlier quoted context omitted.

I am wondering if connecting over USB is an XY problem.

To try and clarify a bit: I am essentially trying to have a KM (KVM without the V) over USB. To go one step higher, I am trying to control a mac mini from the keyboard of a macBook.

Why not use the macs’ built in “sharing” functionality?

Re: Ask HN: Advice for creating a USB device linking 2 computers

#30
post #10

Raspberry Pi definitely works! I have a project you can take a look at; you'll have to modify it slightly since you want a keyboard rather than a joystick, but they're both HID so the majority of it should work pretty much out of the box: https://github.com/saulrh/composite-joystick .

How cool is this?
Post reply on HN