Linux Mint Wine serial port - Solved

Questions and discussion about the ZBasic IDE.
Post Reply
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Linux Mint Wine serial port - Solved

Post by GTBecker »

The archive suggests that others have succeeded in running the IDE under Linux and Wine. The IDE runs great, but I cannot get it to open COM1 linked from USBTTY0, a PL2303 adapter.

Anyone running Linux, Wine and a USB com port?
Last edited by GTBecker on 10 May 2012, 11:03 AM, edited 1 time in total.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Solved. I've compiled, downloaded and run the factory-default LED-flashing code to a -24n - using Wine in Linux Mint.

One more link to Microsoft severed.
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

GTBecker wrote:Solved.
What did you need to do?

I'm running Wine on a Debian VirtualBox. I assign the USB device to the VirtualBox and it shows up as /dev/ttyUSB0. Then, I map that Linux device to a DOS device using a symbolic link:

Code: Select all

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com5
This makes Com5 show up in the IDE's serial port list but it usually gets an error when trying to open it. So far, I haven't been able to download.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

dkinzer wrote:

Code: Select all

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com5
Try just

Code: Select all

ln -s /dev/ttyUSB0 com5
, in /.wine/dosdevices.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

The IDE I installed under Wine is v4.0.0. Compiling several ZX apps exposes a new problem, which also appears under WinXP SP3.

"warning: implicit declaration of function 'zbfracf'".

Screenshot attached, sources in PM.
Attachments
v400zbfractf_Error.GIF
(57.35 KiB) Downloaded 443 times
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

GTBecker wrote:"warning: implicit declaration of function 'zbfracf'"
Thanks. We missed that in the testsuite. You can fix this issue by opening the file zbasic.h (in the zlib subdirectory of the installation directory) in an editor. Find the first line below (near line 1474) and adding the second line below it.

Code: Select all

float zbFracf(float f);
#define zbfracf zbFracf
This will suppress that error but will expose another issue that we haven't seen before: a linker error message saying that zbCheckTaskSwitch is undefined. This can be avoided by making two changes. Firstly, add the file <inst-dir>/zlib/avr/MT/libMT_mega644p.a to your project (where <inst-dir> is the ZBasic installation directory). Secondly, add a call to Yield() just before the first Sleep() call in main.

We have corrected both of these issues in our current development version and we plan to post a new installer soon (most likely later this week).
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Your fixes worked fine. Thanks.

I'm closing in on the Linux serial access issue.

I've found that I need to change the /.wine/dosdevices/ttyUSB0:com1 link ownership from root to me - despite, I believe, creating the link as a user. A boot reverts the ownership back to root, and then Wine (as me) can't open it. I need to figure out how to make the ownership permanent or automatic.

Do you own the link, Don, or does root?
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

GTBecker wrote:Do you own the link (to /dev/ttyUSB0) or does root?
I created the link in ~/.wine/dosdevices while logged in other than root so the link is owned by the non-root user.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Linux Mint Wine serial port

Post by GTBecker »

... I created the link in ~/.wine/dosdevices while logged in other than root so the link is owned by the non-root user...
I did the same, but the link ownership reverts to root at the next boot.  I've needed to edit the link as root to change the ownership back to the user name that created it.  Yours remains owned by the user?
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Linux Mint Wine serial port

Post by dkinzer »

GTBecker wrote:Yours remains owned by the user?
Yes. It may have something to do with how Wine was installed on your system. I don't have a directory /.wine (i.e. in the root); rather, it is located in the user's home directory ~/.wine (where by Linux convention means the user's home directory). The root directory is normally the "home" directory of the root user id.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Well, I've tried a number of methods to retain permissions of the ttyUSB0:tty1 link in ~/.wine/dosdevices. Every boot, unfortunately, reverts the ownership to root. I suppose I should nevertheless be content for now since the owner can be changed manually as su (and that change needn't to be frequent due to Linux's stability), the IDE appears to work fine and can download reliably.

It's time to plead on winehq.org, I guess.
Attachments
ttyUSB0.png
(97.8 KiB) Downloaded 558 times
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

I think I've solved the ttyUSB0:com1 link permissions issue in wine's dosdevices folder by adding my user name to the group "dialout"; owning the link alone seems insufficient and, in fact, always reverts to root at boot. Membership in the user group dialout, though, persists. Finally, I believe I have a fully-functional ZBasic IDE under Wine and Linux Mint.

I must be making some progress: I got an email this morning from Carbonite, which hasn't seen me (via WinXP) for 10 days.
Tom
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post by dlh »

Tom,
It's been some time now so I may be mistaken on details like this but I believe I had to do something similar in Mint itself. I know there were one or two Linux distros where that was needed to access the serial port and it was independent of Wine which I do not use.
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

The sequence I used to establish serial com (in Linux Mint Debian with the Mate GUI) was:

- run lsusb (in Terminal) with a USB serial adapter plugged in. You'll see something like:

Bus 006 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

Find the device ID, e.g. 067b:2303, the vendor and product identifiers. Run:
- sudo modprobe usbserial vendor=0x067b product=0x2303
- dmesg

Somewhere in the dmesg report will be something like this:
[ 31.904669] usbcore: registered new interface driver usbserial
[ 31.904679] USB Serial support registered for generic
[ 31.904717] usbcore: registered new interface driver usbserial_generic
[ 31.904719] usbserial: USB Serial Driver core
[ 31.905716] USB Serial support registered for pl2303
[ 31.905733] pl2303 6-1:1.0: pl2303 converter detected
[ 31.916815] usb 6-1: pl2303 converter now attached to ttyUSB0

The hardware serial port now exists as device ttyUSB0. To link the port to Wine's logical device com1, run:
- sudo nautilus
- navigate to /home/username/.wine/dosdevices (Ctrl^h displays the hidden wine folder)
- click File/OpenInTerminal, run:
- ln -s /dev/ttyUSB0 com1

Link file com1 now appears in .../dosdevices folder. Right click com1, select Properties/Permissions. See that root owns the port, and user group dialout has read/write access to the port. Run:
- mate-users-admin or click Menu/Administration/Users_and_Groups. In Manage Groups, add your user name to group dialout.

You should now be able to open Com1 in Win apps run in Wine, at least using the current Linux Mint Debian 32-bit multi-core distro, and Debian's current Wine (unstable) package, as I did. Linux Mint is said to be 100% Debian, so other Debian-based distros should be similar.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

I've now brought Wine up to the current Debian beta version 1.5.0-0.2 by installing each of 16 .debs (choose 32- or 64-bit and install top-to-bottom), here:

http://dev.carbon-project.org/debian/wine-unstable/

So far, it keeps running!
Tom
Post Reply