Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
04-04-2015, 01:03 AM (This post was last modified: 04-04-2015 01:43 AM by John Galt.)
Post: #1
 John Galt Member Posts: 236 Joined: Oct 2014
Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
Edit: I'm an idiot. All I had to do was to restart Linux.

The rest of this post was deleted because it is no longer relevant.

My thanks to Bit and Marcus anyway. All I had to do was think of you two and it's fixed. Amazing!
04-04-2015, 01:48 AM
Post: #2
 BarryMead Senior Member Posts: 416 Joined: Feb 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
(04-04-2015 01:03 AM)John Galt Wrote:  First thank you both (and others) for your help getting me to configure Ubuntu Linix in a VM so that I can use MySamBa on a Mac.

It was working wonderfully until I messed it up. I inadvertently wiped out my Linux partiton and had to create it from scratch again. Now, I am stuck at a point that should be simple for a Unix expert to fix, but I am not a Unix expert.

I would like to use Minicom to ensure my serial loopback works before attempting to use MySamBa. However, I cannot determine how to get Minicom to recognize the serial port as I did so easily in the past.

For background, this is what I would like to do:

This is what is happening now:

Code:
john@john-VirtualBox:~$minicom minicom: cannot open /dev/ttyUSB0: No such file or directory john@john-VirtualBox:~$ ls /dev/ttyUSB0 /dev/ttyUSB0 john@john-VirtualBox:~$minicom /dev/ttyUSB0 minicom: cannot open /dev/tty8: Permission denied john@john-VirtualBox:~$

Code:
john@john-VirtualBox:~$ls -la /dev/ttyUSB0 lrwxrwxrwx 1 root root 4 Mar 29 22:17 /dev/ttyUSB0 -> com1 john@john-VirtualBox:~$

I am not able to store Minicom's default port parameters. If I attempt to store them Mincom replies "Error: Cannot write to /etc/minicom/minirc.dfl"

What am I doing wrong?

Obviously attempting to use MySamBa fails because I do not understand how Unix communicates to the serial port, and I already bridked one calculator due to my own ineptitude. I am trying to avoid repeating that mistake.

ln -s /dev/ttyUSB0 .wine/dosdevices/com1

This is because the wine system looks in the .wine/dosdevices directory for these device symlinks.
With regard to your minicom problems you could try running minicom as root and you would not get
the permission error about writing to the /etc/minicom/minirc.dfl

Also if you run minicom with the -s paramter it will take you straight into the setup menu where you can
select serial port setup and pick serial device and set it to /dev/ttyUSB0

04-04-2015, 02:33 AM
Post: #3
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
Thank you Barry. That is indeed helpful and I will keep it in mind.

What is the purpose of symbolic links? Can you explain why they are necessary? Until I understand that I'll never remember how to configure them properly.

I have only a vague understanding of its purpose. Is it merely so that MySamBa can associate "com1" with a device, otherwise "com1" would have no meaning to Linux, and MySamBa cannot comprehend anything else?

Anyway, restarting Linux was all I needed to do. After that, I simply entered Minicom, used Ctrl A O to enter its configuration menu, selected Serial Port Setup, set the Serial Device to /dev/ttyUSB0, saved that setup as default, and that was it. The "Permission Denied" roadblock did not reappear.

After confirming the loopback test worked, I used MySamBa, typed com1 in the "connect to" field, and sent the file to the WP 34S. Everything worked.
04-04-2015, 03:32 AM
Post: #4
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa

ln -s /dev/ttyUSB0 .wine/dosdevices/com1

Barry, I hate to bother you but I checked my scrollback buffer and that is in fact the exact command I used. No surprise since it was probably you who provided it to me some months ago :-)

Why do you suspect the symbolic link is incorrect, from the information I posted earlier? The reason for asking is so I can determine what the symbolic link is supposed to look like, after it has been created.
04-04-2015, 10:22 AM
Post: #5
 Marcus von Cube Senior Member Posts: 760 Joined: Dec 2013
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
(04-04-2015 01:03 AM)John Galt Wrote:  Edit: I'm an idiot. All I had to do was to restart Linux.

That should have fixed the device links. Once you create a bad assignment by swapping the ln parameters for example the original device node no longer works. A reboot should cure this.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
04-04-2015, 03:40 PM (This post was last modified: 04-04-2015 06:29 PM by John Galt.)
Post: #6
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
Thanks Marcus. Why do you suppose I got "permission denied"? I added my account to the "dialout" group, but that was prior to rebooting. Was that the reason? I can think of no other.
04-04-2015, 05:54 PM
Post: #7
 BarryMead Senior Member Posts: 416 Joined: Feb 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
(04-04-2015 03:32 AM)John Galt Wrote:  Why do you suspect the symbolic link is incorrect, from the information I posted earlier? The reason for asking is so I can determine what the symbolic link is supposed to look like, after it has been created.
the ls -l /dev/ttyUSB0 command above should not point to com1

an ls -l of .wine/dosdevices/com1 should point to /dev/ttyUSB0 however. That is how I knew that the symlink
was wrong.

Symbolic links are "Pointers" that allow a file to be accessed by another name. Wine uses them to make
the windows devices point to Linux path names for the appropriate devices.
04-04-2015, 06:28 PM
Post: #8
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
(04-04-2015 05:54 PM)BarryMead Wrote:  an ls -l of .wine/dosdevices/com1 should point to /dev/ttyUSB0 however.

Thanks Barry! That is exactly what it did after a reboot.

(04-04-2015 05:54 PM)BarryMead Wrote:  Symbolic links are "Pointers" that allow a file to be accessed by another name. Wine uses them to make the windows devices point to Linux path names for the appropriate devices.

Brilliant. That is the explanation I needed.
12-20-2019, 05:46 PM
Post: #9
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
I'm trying to configure a brand new Linux installation and am encountering problems similar to those I described here years ago. I don't recall all the details regarding how I made it work back then, but the snag I'm hitting involves either symlink creation or a device driver. I'm still using the same device, which continues to work on a virtual machine to program the calc, so I can easily compare that working system to the new system that isn't cooperating.

The original system that works is running Ubuntu Linux in a virtual machine. The problem is on the new one, I can't seem to create a symlink that points to the device I need:

As I understand it, wine requires a symlink (ttyUSB0) that points to .wine/dosdevices/com1.

/dev/ttyUSB0 does not exist in a brand new system, but I seem to recall that's what I needed to create so I can use the same USB to serial device I have been using all along.

On the system that works (the virtual Linux machine):

Code:
john@john-VirtualBox:~$ls -l .wine/dosdevices/com1 lrwxrwxrwx 1 john john 12 Mar 29 2015 .wine/dosdevices/com1 -> /dev/ttyUSB0 john@john-VirtualBox:~$

Looks good, and everything works. MySamBa and everything, all ok.

Now, I need to reproduce that symlink on the new system, but it's not working.

This is what I did to create it on the new system (not a virtual machine):

Code:
john@john-iMac:~$sudo ln -s ~/.wine/dosdevices/com1 /dev/ttyUSB0 [sudo] password for john: john@john-iMac:~$

Looks ok so far, but it's ignoring me:

Code:
john@john-iMac:~$ls -l ~/.wine/dosdevices/com1 lrwxrwxrwx 1 john john 10 Dec 20 07:52 /home/john/.wine/dosdevices/com1 -> /dev/ttyS0 john@john-iMac:~$

You see how the working system is pointing to ttyUSB0 while the problematic one stubbornly points to ttyS0? The USB to serial converter won't work that way.

Here is an obvious clue, but I don't know what it means.

On the system that's working:

Code:
john@john-VirtualBox:~$ls -l /dev/ttyUSB0 ls: cannot access /dev/ttyUSB0: No such file or directory john@john-VirtualBox:~$

On the system that is not working:

Code:
john@john-iMac:~$ls -l /dev/ttyUSB0 lrwxrwxrwx 1 root root 33 Dec 20 11:55 /dev/ttyUSB0 -> /home/john/.wine/dosdevices/com1 john@john-iMac:~$

Obviously I created /dev/ttyUSB0 and it's owned by root, but on the system that is working, there is no /dev/ttyUSB0. That implies it shouldn't exist, not there anyway.

So I know what the symlink is supposed to look like, but I do not know how to properly create it.

What am I doing wrong?
12-20-2019, 06:19 PM
Post: #10
 Claudio L. Senior Member Posts: 1,847 Joined: Dec 2013
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
(12-20-2019 05:46 PM)John Galt Wrote:  What am I doing wrong?

If /dev/ttyUSB0 is not created automatically when you plug the device, then the driver for the device is incorrect, or the serial device is not supported by Linux.
Check with dmesg and lsusb to see which driver is being associated to your device. It's probably the wrong driver.
99% of devices use the FTDI chipset, so you might want to try this trick to add your device to the list of devices recognized by the FTDI generic driver.
12-20-2019, 06:24 PM
Post: #11
 grsbanks Senior Member Posts: 1,219 Joined: Jan 2017
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
Start by deleting the old symlink:

Code:
rm ~/.wine/dosdevices/com1

Then create the new one (no need to use sudo, you're creating a symlink below your own home directory so you have permissions)

Code:
ln -s ~/.wine/dosdevices/com1 /dev/ttyUSB0

There are only 10 types of people in this world. Those who understand binary and those who don't.
12-20-2019, 08:17 PM
Post: #12
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
Quote:If /dev/ttyUSB0 is not created automatically when you plug the device, then the driver for the device is incorrect, or the serial device is not supported by Linux.

Thank you for that. I had no idea it would be created automatically, but it is, which you'll see later. lsusb reports it's connected, and dmesg logs its connection and disconnection. I installed no drivers so I suppose that's good news.

Beginning with the USB to serial device disconnected:

Code:
john@john-iMac:~$rm ~/.wine/dosdevices/com1 john@john-iMac:~$ ln -s ~/.wine/dosdevices/com1 /dev/ttyUSB0 ln: failed to create symbolic link '/dev/ttyUSB0': File exists john@john-iMac:~$rm /dev/ttyUSB0 rm: cannot remove '/dev/ttyUSB0': Permission denied john@john-iMac:~$ sudo rm /dev/ttyUSB0 [sudo] password for john:  john@john-iMac:~$ln -s ~/.wine/dosdevices/com1 /dev/ttyUSB0 ln: failed to create symbolic link '/dev/ttyUSB0': Permission denied john@john-iMac:~$ sudo ln -s ~/.wine/dosdevices/com1 /dev/ttysUSB0 john@john-iMac:~$ls -l /dev/ttyUSB0 ls: cannot access '/dev/ttyUSB0': No such file or directory john@john-iMac:~$ ls -l ~/.wine/dosdevices/com1 ls: cannot access '/home/john/.wine/dosdevices/com1': No such file or directory

From this, I concluded attempting to create /dev/ttyUSB0 manually was a bad idea which wasn't working anyway. Deleting ~/.wine/dosdevices/com1 might also have been a bad idea, but I suppose I can always install wine again.

Then: I plugged it in and did the following:

Code:
john@john-iMac:~$ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 Dec 20 14:43 /dev/ttyUSB0 Wow magic! I had to repeat it to be sure (twice in fact, LOL): Code: john@john-iMac:~$ ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 Dec 20 14:43 /dev/ttyUSB0 john@john-iMac:~$ls -l ~/.wine/dosdevices/com1 ls: cannot access '/home/john/.wine/dosdevices/com1': No such file or directory john@john-iMac:~$ ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 Dec 20 14:43 /dev/ttyUSB0 john@john-iMac:~$ln -s ~/.wine/dosdevices/com1 /dev/ttyUSB0 ln: failed to create symbolic link '/dev/ttyUSB0': File exists john@john-iMac:~$

In summary: ttyUSB0 magically appears when connecting the device. Yay! I thought I had to work at it.

Sadly MySamBa still doesn't want to communicate. I select COM1 from the dropdown menu, connect both ends, configure the calc for SamBa Boot, hit Send, and I immediately get "unable to connect <ok>".

To make the calculator work again, I merely connect to the virtual machine, send the file, and it's back to life.

Still stuck. Everything I did with Terminal is shown above. Note that I still needed to use sudo for reasons I don't understand.

Any idea where to go from here? Obviously symlinks are confusing the *** out of me.
12-20-2019, 09:56 PM (This post was last modified: 12-20-2019 09:57 PM by John Galt.)
Post: #13
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
OK this is really weird. I rebooted the Linux machine and attempted to communicate using MySamBa again. Failed again. No surprise.

Upon examining the contents of ~/.wine/dosdevices, I came across the following entry (among all the others):

Code:
lrwxrwxrwx 1 john john 12 Dec 20 16:46 com33 -> /dev/ttyUSB0

In MySamBa, I selected COM33 from the dropdown menu, and sent the file. It works!

Given what I did, how in blazes did COM33 become created there? Obviously I screwed something up. Can I undo it? It's probably not necessary, but it would be nice to have a consistent UI. It would be even nicer if I knew what the heck I was doing.
12-21-2019, 08:36 AM
Post: #14
 grsbanks Senior Member Posts: 1,219 Joined: Jan 2017
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
(12-20-2019 08:17 PM)John Galt Wrote:
Code:
john@john-iMac:~$rm ~/.wine/dosdevices/com1 john@john-iMac:~$ ln -s ~/.wine/dosdevices/com1 /dev/ttyUSB0 ln: failed to create symbolic link '/dev/ttyUSB0': File exists

Apologies about that, it should have been:

Code:
ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1

I'm always getting the target and symlink name in the wrong order...

There are only 10 types of people in this world. Those who understand binary and those who don't.
12-22-2019, 04:01 AM
Post: #15
 John Galt Member Posts: 236 Joined: Oct 2014
RE: Bit and / or Marcus: help setting up Ubuntu Linux for flashing with MySamBa
Ha, no worries. My problems were entirely self-inflicted because I had no idea /dev/ttyUSB0 would be created automatically.

The USB to serial device probably wasn't connected, therefore /dev/ttyUSB0 wasn't present, and I felt compelled to create it with sudo. All of that was totally unnecessary. I was expecting things to be difficult, and I made it so!

Claudio set me straight, which piqued my curiosity: In addition to the Prolific device and homemade cable / connector I had been using, I also had a USB to serial converter on the shelf that I never used before: a Keyspan / Tripp-Lite USA-19HS which I believe is an FTDI-based device. I plugged it in and did nothing else. Much to my amazement, Linux also detected it automatically, and MySamBa sent the file to the WP-34s just as easily.

The only difference between my original question four years ago and now is that I'm using a Mac running Linux natively, which runs slightly faster than it does in emulation. VirtualBox has a convenient icon indicating USB activity whereas the native Linux system doesn't, so there had always been a question in my mind about how device drivers interact with hardware. Did I need to install macOS drivers? Windows drivers? Was it even communicating with the device? I had no idea. As it turns out I didn't need to install any device drivers, Windows or otherwise. Linux just works. All I had to do was let it.

Of course Windows / PCs complicate matters with "com ports" that exist only in its world. My only remaining question is what to do about that inconveniently named "com33" port, which I probably exacerbated by deleting ~/.wine/dosdevices/com1. I suspect Wine created com33 automatically; I certainly didn't. Not a big deal though, now that I know where to look and what to expect. If necessary I can even install Wine all over again. Or Linux for that matter. It wasn't difficult; I just had to remember what I did long ago.

Thanks once again for everyone's help.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)