LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 11-21-2004, 11:56 PM   #1
jfbertrand
LQ Newbie
 
Registered: May 2002
Posts: 17

Rep: Reputation: 0
Problems with ttyS2


Sup?

I need to control 3 serial devices on a board (ttyS0 for touch screen, ttyS1 for bill validator, and ttyS2 for a printer) ... should be easy enough right? well not that easy, first off, it would seem that the serial driver only loads S0 and S1 on statup which after a few hours reading the setserial and rc.serial files figured out kinda how to do it. And I say kinda because ... you've guessed it, I'm asking a question here.

I get, S0 and S1 and they work great, but I can't for the life of me to get S2 to work at all, nothing.

What to do, what to do?

Thanks all for you help, and REALLY, what a great site...

Later,

JF
 
Old 11-22-2004, 03:14 AM   #2
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 881

Rep: Reputation: 130Reputation: 130
Hello, JF.

Not knowing which distribution you're using this is a shot in the dark, but here is my /etc/rc.d/rc.serial file from Slackware 10. I have S0 through S4 working pretty well with this arrangement. (Other distributions put this file in init.d or elsewhere.)

Code:
#
# /etc/rc.serial 
#	Initializes the serial ports on your system
#
# chkconfig: 2345 50 75
# description: This initializes the settings of the serial port
#
# FILE_VERSION: 19981128
#
# Distributed with setserial and the serial driver.  We need to use the
# FILE_VERSION field to assure that we don't overwrite a newer rc.serial 
# file with a newer one.
# 
# XXXX For now, the autosave feature doesn't work if you are
# using the multiport feature; it doesn't save the multiport configuration
# (for now).  Autosave also doesn't work for the hayes devices.  
#

RCLOCKFILE=/var/lock/subsys/serial
DIRS="/lib/modules/`uname -r`/misc /lib/modules /usr/lib/modules ."
PATH=/bin:/sbin:/usr/bin
DRIVER=serial
DRIVER_NAME=serial
MODULE_REGEXP="serial\b"

ALLDEVS="/dev/ttyS?"
if /bin/ls /dev/ttyS?? >& /dev/null ; then
	ALLDEVS="$ALLDEVS /dev/ttyS??"
fi

SETSERIAL=""
if test -x /bin/setserial ; then
	SETSERIAL=/bin/setserial
elif test -x /sbin/setserial ; then
	SETSERIAL=/sbin/setserial
fi

#
# See if the serial driver is loaded
#
LOADED=""
if test -f /proc/devices; then
	if grep -q " ttyS$" /proc/devices ; then
		LOADED="yes"
	else
		LOADED="no"
	fi
fi

#
# Find the serial driver
#
for i in $DIRS
do
	if test -z "$MODULE" -a -f $i/$DRIVER.o ; then
		MODULE=$i/$DRIVER.o
	fi
done

if ! test -f /proc/modules ; then
	MODULE=""
fi


#
#For USR5610B Modem: 
#Define location and serial port for PCI modem
#
COMMDM=/usr/local/bin/3ComMdm
COMPORT=/dev/ttyS0


#ALLDEVS="/dev/ttyS?"
#if /bin/ls /dev/ttyS?? >& /dev/null ; then
#        ALLDEVS="$ALLDEVS /dev/ttyS??"
#fi





#
# Handle System V init conventions...
#
case $1 in
start)
	action="start";
	;;
stop)
	action="stop";
	;;
*)
	action="start";
esac

if test $action  = stop ; then
	if test -n ${SETSERIAL} -a "$LOADED" != "no" -a \
           `head -1 /etc/serial.conf`X = "###AUTOSAVE###X" ; then
		echo -n "Saving state of serial devices... "
		grep "^#" /etc/serial.conf > /etc/.serial.conf.new
		${SETSERIAL} -G -g ${ALLDEVS} >> /etc/.serial.conf.new
		mv /etc/serial.conf /etc/.serial.conf.old
		mv /etc/.serial.conf.new /etc/serial.conf
		echo "done."
	fi
	if test -n "$MODULE" ; then
		module=`grep $MODULE_REGEXP /proc/modules | awk '{print $1}'`
		if test -z "$module" ; then 
			echo "The $DRIVER_NAME driver is not loaded."
			rm -f ${RCLOCKFILE}
			exit 0
		fi
		if rmmod $module ; then :; else 
			echo "The $DRIVER_NAME driver could NOT be unloaded."
			exit 1;
		fi
		echo "The $DRIVER_NAME driver has been unloaded."
	fi
	rm -f ${RCLOCKFILE}
	exit 0
fi

#
# If not stop, it must be a start....
#

if test -n "$MODULE" -a "$LOADED" != "yes" ; then 
	if insmod -f $MODULE $DRIVER_ARG ; then
          true
	else
		echo "Couldn't load $DRIVER_NAME driver."
		exit 1
	fi
fi

if test -f /etc/serial.conf ; then
        if test -n ${SETSERIAL} ; then
		grep -v ^# < /etc/serial.conf | while read device args
		do
                    if [ ! "$device" = "" -a ! "$args" = "" ]; then
                        ${SETSERIAL} -z $device $args
                    fi
		done 
	fi
else
	echo "###AUTOSAVE###" > /etc/serial.conf
fi

touch ${RCLOCKFILE}
${SETSERIAL} -bg ${ALLDEVS}
I hope this helps. Please note that I've made some changes to this file to support my 56k modem. For a detailed list of what changes I made see the HOW-TO for the USR6510B in the "answers" section of LQ.

Good luck.

--Dane
 
Old 11-22-2004, 09:49 AM   #3
jfbertrand
LQ Newbie
 
Registered: May 2002
Posts: 17

Original Poster
Rep: Reputation: 0
I'm running fedora core 2, w/ an upgraded hardware module that might affect my serial components. I'll do more research.

When I get home, I'll send you the content of my serial.conf file and whatever is in my rc.serial

also, /proc/tty/driver/serial .

Thanks,

JF
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No init on /dev/ttyS2 (modem) gamfa Amigo 0 01-24-2005 08:52 PM
Problems, problems, problems. Lets start with the soundcard Kre8ive Linux - Newbie 5 08-07-2003 01:20 AM
Problems, problems, problems. Lets start with the ES 1868 AudioDrive Kre8ive Linux - Newbie 1 08-06-2003 07:04 PM
/dev/ttyS2: No such file or directory mkzmonkeylagger Linux - General 2 04-18-2002 09:03 PM
ttyS2 & setserial awtoc123 Linux - Networking 0 04-01-2002 10:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration