CH9329 + CH340 UART/TTL Serial Port to USB HID Full Keyboard and Mouse Cable

I'm trying to use one of these CH9329 + CH340 UART/TTL Serial Port to USB HID Full Keyboard and Mouse Cable to send keystrokes over USB from a 14.2 source host to a 13.2 target host.

Plugging one end gives this, which seems to be the target keyboard HID:

Code:
ugen6.3: <WWW.WCH.CN WCH UART TO KB-MSV1.8> at usbus6
ukbd0 on uhub8
ukbd0: <WWW.WCH.CN WCH UART TO KB-MSV1.8, class 0/0, rev 1.10/38.00, addr 3> on usbus6
kbd2 at ukbd0
uhid0 on uhub8
uhid0: <WWW.WCH.CN WCH UART TO KB-MSV1.8, class 0/0, rev 1.10/38.00, addr 3> on usbus6
uhid1 on uhub8
uhid1: <WWW.WCH.CN WCH UART TO KB-MSV1.8, class 0/0, rev 1.10/38.00, addr 3> on usbus6
ums0 on uhub8
ums0: <WWW.WCH.CN WCH UART TO KB-MSV1.8, class 0/0, rev 1.10/38.00, addr 3> on usbus6
ums0: 5 buttons and [XYZ] coordinates ID=1
ums0: 5 buttons and [Z] coordinates ID=2

Plugging the other end gives this, which seems to be the source UART:

Code:
ugen0.2: <vendor 0x1a86 USB Serial> at usbus0
uchcom0 on uhub5
uchcom0: <vendor 0x1a86 USB Serial, rev 1.10/2.64, addr 2> on usbus0
uchcom0: CH340 detected

tio finds these devices on the source host, but connecting doesn't seem to do anything. I have a display connected to the target machine and I don't see anything changing.

Code:
# tio --list
Device            TID     Uptime [s] Driver           Description
----------------- ---- ------------- ---------------- --------------------------
/dev/ttyU0                   138.136
/dev/ttyU0.init              138.136
/dev/ttyU0.lock              138.136
/dev/cuaU0                   138.136
/dev/cuaU0.init              138.136
/dev/cuaU0.lock              138.136

# tio /dev/cuaU0
[17:42:11.834] tio v3.7
[17:42:11.834] Press ctrl-t q to quit
[17:42:11.948] Connected to /dev/cuaU0

# tio /dev/ttyU0
[16:47:06.097] tio v3.7
[16:47:06.097] Press ctrl-t q to quit
[16:47:06.211] Connected to /dev/ttyU0

I also tried cu but it doesn't seem to do anything either:

Code:
# cu -s 9600 -l /dev/cuaU0
Connected
Connection to server closed.

# cu -s 9600 -l /dev/ttyU0
Connected
Connection to server closed.

Can anyone tell me how to get this working?
 
I looked at this device and nothing looks special. Is one end marked HOST and one end marked TARGET? I would think it matters.

On host side no settings should be necessary but on the target you are going to need loader settings:

/boot/loader.conf
Code:
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole,vidconsole"
For UEFI you can plug efi in for console setting.

You might also have to tinker with /etc/ttys on target.

FreeBSD kernel has speed at 115000 but part of early loader might be 9600. You can just leave it out and run as cu -l /dev/ttyU0

My operational use would be plug in device to HOST and establish cu session. Then plug into TARGET with boot_serial set.
Now turn on target.
You should then see output on HOST cu session. If garbled characters wrong baud usually.
If you see backslashes twirling that might be BEASTIE early loader and is OK. Let it go.
 
The ends aren't labeled, but the big end appears to have both ICs in it and gives kbd messages in the log when I plug it into the target machine as if it were a physical keyboard. As far as I understand it, the big end of the cable presents as a USB HID keyboard. I wouldn't think the target machine needs any additional configuration because it should just act like a USB keyboard got pluged in. The target machine also has a monitor attached, so I should see the keyboard output there when I type into cu on the other host.

The small end of the cable just appears to be a regular USB connection. Plugging it into the source host gives CH340 messages and adds the two new TTY devices (ttyU0 and cuaU0) to the system. I was hoping that cu would be able to connect to one of those TTYs, accept key presses, and pass them out the other end as keyboard input.

The seller says it works with Windows, but I still need to try that to make sure the hardware is good.
 
Back
Top