Accessing Linux Serial Devices Linux Host and Windows Guest

I am kind of banging my head against the wall and my wife is getting upset with all the time I am spending on this issue!

I have VirtualBox 6.1 installed in Ubuntu 20.04 on a 2011 MacBook Pro on which Ubuntu is the only OS (this computer had died the death of the SBBOD* when it hit High Sierra). I have 32 bit Windows 7 installed in VirtualBox to run only one Windows program, the programming software for my Anytone 878 DMR radio. When the cable to the radio is plugged in and the radio is turned on, the new item in /dev is /dev/ttyACM0, as determined by comparing the files in the /dev directory with diff before and after plugging the cable in with the radio turned on. I have the VirtualBox serial settings with Port 1 enabled as com1, mode “Host device.” I have the Linux extensions installed in Ubuntu and the Guest Additions installed in Windows. I am running GD3264 (the 32 bit driver) as the virtual com port driver in Windows.

The program (called CPS or Customer Programming Software by Anytone) loads into Windows fine, and my data file (called a codeplug in DMR lingo) loads, edits and saves just fine. But when it is time to transfer the programming to the radio, the program sees the com port and allows me to choose it, but when I hit Transfer to Radio, the dialog goes along just fine until I hit the final button, and the result is “Cannot Open Communications Port.”

I am pretty sure this is some kind of permissions issue, although maybe not. I have tried “sudo chmod a+rw /dev/ttyACM0” with no success. I even tried creating a rules file with entries that I don’t understand. It seems like Windows in VirtualBox just can’t do what needs to be done here.

I would sincerely appreciate anyone, well, anyone who knows what they arer talking about, to explain what I am doing wrong and what I need to do so my program can open the com port and write my data file to the radio. Thanks!

  • SBBOD = “Spinning Beach Ball of Death,” a phenomenon all to well know to owners of old Macs…

if you run either dmesg -w or journalctl -f when you attach the radio to your system, you should get a good set of info about it including (hopefully) where it was mounted so you don’t have to guess or diff. journactl makes that a little more plain (an example of me inserting a usb drive):

Sep 03 16:29:13 h0stn@me systemd[1]: Started Clean the /media/user/usb2 mount point.
Sep 03 16:29:13 h0stn@me udisksd[728]: Mounted /dev/sdc1 at /media/user/usb2 on behalf of uid 1000

though it sounds like the communication is failing to exit windows, if you want to see if it is a permission or ubuntu issue you might leave journactl -f running from before you try to make the transfer. i realize the systems involved are different, but when i couldn’t set up bluetooth journalctl -f helped me see when requests were being rejected and eventually the error message helped me get things sorted.

1 Like

Thread Hijack alert (it’s yet another rum Friday) :

I’m assuming this is a USB serial device that you plug in to a USB port…

Can’t you just pass that USB device through to the VM (never had to do this before - but I’ve seen people resort to this to get a Kali VM to direct access a USB wifi dongle)… I’m pretty sure there’s a way to let/get Virtual Box to be the “owner” of the new device, and remove it from the host os (so that it’s exclusive to the guest os - Kali users do this shit all the time - but not me - I kinda hate Kali users [but mostly only when the intertubes are flooded with Kali AND Linux noobs after another episode of Mr Robot])…

Search terms :
virtualbox pass through USB kali wifi

Tangent :
One thing I’m doing all the time (well not “all” - only when I need serial coms over USB) - e.g. using /dev/ttyUSB0 for my pl2303 USB / serial dongle - to get a serial console on my Sun Sparc server I run a shell script that does this :

chmod -Rf root:root /dev/ttyUSB0 (not always needed, but I do it sometimes, to be sure, to be sure [yes I have Irish ancestry])
chmod 777 /dev/ttyUSB0

which is probably overkill, but after this I can usually do something like :

cu- l /dev/ttyUSB0 -s 9600 # yes - Sun boxes don’t like going faster than 9600 baud

the other times - it’s /dev/ttyACM0 (like your device), and it’s one of my NTC CHIP computers, which amazing packed a whole Power Management Circuit and RS232 onchip onto something the size of a Raspberry Pi Zero - and invariably I will do the same thing :

chown -Rf root:root /dev/ttyACM0
chmod 777 /dev/ttyACM0
cu -l /dev/ttyACM0 -s 115200 

(yes - Sun Microsystems sparc servers couldn’t go faster than 9600 baud on their RS232 console, but a tiny little startup in Oakland CA can deploy something on a single chip [also RISC] capable of 12x the throughput :smiley: )

The main reason for this overkill, is that sometimes, many times, “cu” thinks the line is still open - and this “overkill” effectively does a hangup (if anyone here remembers analog phones - or process control in UNIX - e.g. send a daemon a sighup signal)…

In other news, I recenly lost my 25 year old “blue” Laplink (genuine, with Laplink logos on the plastic!) cable (just a null modem cable, but with 9 pin and 25 pin connectors on each end but never let me down in 25 years!) - nearly ended up breaking out my pin based USB PL2303 (who even remembers which pin is RX and which is TX and which is GND? and I’m colour blind too!), but found another null modem cable that fit the bill (console onto my SunBlade 2500 SparcStation)… and that was only 'cause I’m lazy, too lazy to charge up my “AirConsole” dongle, which let’s me wifi or bluetooth using a “virtual” serial port (e.g. I connect it to the 9 or 25 pin RS232 pin on some piece of kit [e.g. a Cisco router, a Sparc server, a server blade chassis, a NetApp filer] - and if bluetooth’s not working, I can just HTTP to the AirConsole itself, and it will present HTML terminal sessions onto the serial line…

Summary - I barely know anything about RS232 whatsoever, just enough to know to try and steer clear of it where-ever humanly possible…

1 Like

Thanks, Daniel - this is a lot to think about, I will see what I can do. VBox has a setting for Serial Ports. I have enabled the serial port com1, and given the path as /dev/ttyACM0, and installed a virtual serial port driver in Windows. You would think that would simply pass it through to Windows, and it does to extent that Windows programs can SEE com 1, but my program reports that it can’t open the port. If I could somehow make that exclusive to Windows und VBox, and did the chmod, it might work. I will ponder this and experiment. Going crusing on my little boat for a few days, so I am giving this a rest for about a week, but I am not giving up!

I tried this, and did not have a clue what the output meant. I might try again and copy and paste the output for some expert interpretation! Thanks!

1 Like

My suggestion - is to ignore serial ports in VBox - and pass thru the actual USB device… I’m sure that’s there somewhere… because from your description of /dev/ttyACM0, I am pretty sure that’s a USB device…

Just for sh!ts and giggles - I might have a look at this tomorrow, figure out how to pass thru my PL2303 USB :
Bus 002 Device 003: ID 0557:2008 ATEN International Co., Ltd UC-232A Serial Port [pl2303] - so it’s exclusive to VBox, and my Windows 7 VM can access it (note there are problems with many PL2303 chipsets - the vendor disabled the Windows drivers because of the plethora of Shenzein reverse engineered clones - there’s pre-2016 driver sources for victims of this “scam” - don’t have links anymore - but that’s an aside, I’m pretty sure my ATEN PL2303 dongle is genuine).

1 Like

Problem solved, it was a setting in VirtualBox that was pointed out to me by someone on the Anytone radio Facebook Group. In the USB settings in VirtualBox, there is a button, not the top one and not explained in VB documentation, with a “+” on it. When you click that button, it lists all the USB things you have that can be passed through to VB, although in this case it was not host devices, it was actually the virtual com port driver installed in Windows that needed to be checked. As soon as I did that, my radio programming software let me set the com port and read from / write to the radio.

So it was not a Linux solution at all, it was a VirtualBox solution that would probably have been the same on, say, a Mac host.

Thanks all for your suggestions, though. I really think the ItsFOSS community will be a great resource, since I will continue to use the Linux computer as my main machine!

1 Like