Serial port stopped working under wine!

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
sv1cdn
Newbie
Newbie
Posts: 4
Joined: Wed Mar 25, 2009 6:18 pm

Serial port stopped working under wine!

Post by sv1cdn »

Hello all!
Using Ubuntu 8.10 and Wine 1.0.1
Been using Wine since Ubuntu 7.10 and run a windows application with serial port I/O fine. Yeasterday I noticed that my application was not receiving data I/O from serial device, but it could very well send serial I/O data to the device.
So I tried to setup again the application. This time my windows application saw no serial port present. I forced it to COM1 yet it has stopped working at all!
Tested serial port with Ubuntu software, working fine. Tested with Windows 2000 (dual boot) working fine. Made a symbolic link at ~/.wine/dosdevices to my ttyS0 but still problem. Never had to make a link though! Ubuntu dmesg reports serial ports fine.
HELP! What went wrong? Any idea from you gurus?
Take care.
Dennis.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Serial port stopped working under wine!

Post by vitamin »

sv1cdn wrote:What went wrong?
Check permissions on /dev/ttyS0. One of the latest updates had something to do with HAL(dbus) default permissions.
sv1cdn
Newbie
Newbie
Posts: 4
Joined: Wed Mar 25, 2009 6:18 pm

Re: Serial port stopped working under wine!

Post by sv1cdn »

vitamin wrote:Check permissions on /dev/ttyS0. One of the latest updates had something to do with HAL(dbus) default permissions.
Thank you! Could you help me a bit more, I am kind of new. In /dev/ you want me to get an ls -la for ttyS0 ?
Martin Gregorie

Serial port stopped working under wine!

Post by Martin Gregorie »

On Thu, 2009-03-26 at 10:04 -0500, sv1cdn wrote:
vitamin wrote:
Check permissions on /dev/ttyS0. One of the latest updates had something to do with HAL(dbus) default permissions.
Thank you! Could you help me a bit more, I am kind of new. In /dev/ you want me to get an ls -la for ttyS0 ?
The following has been tested for Fedora 8 but should also work with any
Linux distro that uses udev to manage devices or runs the contents of
the /etc/rc.d/rc.local script during the boot process.

The problem was that the standard serial ports /dev/ttyS* and the USB
serial ports /dev/ttyUSB* are owned by root and by default only give
read and write access to their owner and the 'uucp' group. This means
that a normal user can't run programs that access them.

I know two solutions:

1) The kludge. Add the command

chmod uga+rw /dev/tty[A-Z]*

into /etc/rd.d/rc.local

By default this script is run as part of the boot process
but contains nothing except comments saying when it is run
and what it is for.

2) A cleaner solution. Add an overriding rule to the UDEV rules set.
These are run at boot time to set up the device files in /dev.
Add the following file to /etc/udev/rules.d and make sure it is
owned by root.root and has "rw-r--r--" permissions. Here's the file:

=========== /etc/udev/rules.d/51-local.rules ==========================
#
# Locally defined rules.
#

#
# Give world read/write access to ttyS* and ttyUSB* serial devices
#
KERNEL=="tty[A-Z]*", GROUP="uucp", MODE="0666"

=======================================================================

You may need to change the file name, which must not overwrite or
modify an existing file and MUST follow the file containing a
rule that sets the serial ports mode to "0660". Run

grep 'KERNEL=="tty[A-Z]*"' /etc/udev/rules.d/*

to check which file that is. In my system its in
/etc/udev/rules.d/50-udev-default.rules but other distros may differ.
Your new file must start with a number that's higher than that of the
file containing the default rule.


Martin
sv1cdn
Newbie
Newbie
Posts: 4
Joined: Wed Mar 25, 2009 6:18 pm

[SOLVED] serial port in wine 1.0.1 - ubuntu 8.10

Post by sv1cdn »

Many thanks to all!
Martin I confirm your solution worked for me!
Made a file 41-local.rules since I discovered with your grep that 40- was the previous file. Now in /dev my ttyS* are in group uucp when before they were at group dialout.
Take care!
Martin Gregorie

Serial port stopped working under wine!

Post by Martin Gregorie »

On Thu, 2009-03-26 at 17:03 -0500, sv1cdn wrote:
Martin I confirm your solution worked for me!
Excellent!
Made a file 41-local.rules since I discovered with your grep that 40-
was the previous file. Now in /dev my ttyS* are in group uucp when
before they were at group dialout.
It might be a good idea to change the group to 'dialout' in your
41-local.rules file because that's the default for your distro. Its just
possible that leaving it as 'uucp' may break something. Just change the
file and next time you boot your system the correction will be applied
automatically.

Another thing: be sure to keep a copy of 41-local.rules in a safe place
(somewhere in your usual login's home directory is good provided its
backed up. On paper is good too) because upgrades might delete the file
and a clean install of a new version of Linux WILL delete it.


Martin
sv1cdn
Newbie
Newbie
Posts: 4
Joined: Wed Mar 25, 2009 6:18 pm

Still works but...

Post by sv1cdn »

Martin, thank you once more!
I made a backup of the configuration, understanding your suggestions.
Weird thing is that when I changed the group to dialup, made a reboot and then ls -la ttyS* at /dev I can see all ttyS* in group root.
Wine still works fine, so maybe I will just let it be...
Martin Gregorie

Serial port stopped working under wine!

Post by Martin Gregorie »

On Sat, 2009-03-28 at 12:25 -0500, sv1cdn wrote:
Martin, thank you once more!
I made a backup of the configuration, understanding your suggestions.

Weird thing is that when I changed the group to dialup, made a reboot
and then ls -la ttyS* at /dev I can see all ttyS* in group root.
That's expected - root can see everything..

As a general point, if you manually change anything in /etc its a good
idea to back it up the same way. Obvious candidates are the
configuration files for services like Samba, Postfix, Spamassassin and
ntpd. Also anything you change
in /etc/rc.d/init.d, /etc/profile.d, /etc/hosts or /etc/cron.*

The big difference from Windows is that you can make these changes
easily with a text editor instead of having to make non-obvious changes
to a registry. You also get to keep the files so you can copy them to
another computer or put them back after a doing a clean install of a
later Linux distro.

This isn't stuff you'd want to do immediately, but as you get to know
Linux you may find there are things you want to do with it, such as
running your own mail server, an internal web site or Samba (which makes
Linux become a Windows file and print server). All these are useful
things to do if you have several people using computers on your home
network.
Wine still works fine, so maybe I will just let it be...
Good news.


Martin
Locked