Using serial modem: Difference between revisions

From Alpine Linux
(→‎Checks: notes on setserial command)
(Cleaning up, adding setserial notes, etc.)
Line 6: Line 6:
Install alpine-2.1.3 or newer (see [[Installation|these]] notes if you are unsure how to do it).<BR>
Install alpine-2.1.3 or newer (see [[Installation|these]] notes if you are unsure how to do it).<BR>
And do basic setup (run 'setup-alpine').
And do basic setup (run 'setup-alpine').
== Hardware ==
Choose what ttyS port to use. ''(In below examples replace ttyS? with the ttyS? that applies for your needs)''<BR>
* /dev/ttyS0 is same as COM1
* /dev/ttyS1 is same as COM2
* ''(and so on...)''


== Install packages ==
== Install packages ==
Line 18: Line 24:
  apk add setserial
  apk add setserial


== Load modules ==
== Modules ==
{{Note|I am not sure what modules is needed}}
Load some needed modules and make sure they get automatically loaded at next reboot
If we need to load some modules we need to make sure we add them to /etc/modules
modprobe ppp
 
echo "ppp" >> /etc/modules
== Check and set serial speed ==
{{Note|I am not sure how to do that}}


== Configure ==
== Configure ==
Create a missing folder
mkdir -p /etc/ppp/peers


=== Create configfiles ===
=== Create configfiles ===
Line 46: Line 48:
  user "irrelevant"
  user "irrelevant"
  password "irrelevant"
  password "irrelevant"
  connect '/usr/sbin/chat -f /etc/ppp/chat-serialmodem-pin || /usr/sbin/chat -f /etc/ppp/chat-serialmodem-nopin'
  connect '/usr/sbin/chat -f /etc/ppp/chat-serialmodem'


{{Note|This is a draft config - it needs fixing}}
{{Note|This is a draft config - it needs fixing}}
'''''/etc/ppp/chat-serialmodem-pin'''''
'''''/etc/ppp/chat-serialmodem'''''
  ABORT BUSY
  ABORT BUSY
  ABORT ERROR
  ABORT ERROR
Line 65: Line 67:
  CONNECT \c
  CONNECT \c


{{Note|This is a draft config - it needs fixing}}
'''''/etc/ppp/chat-serialmodem-nopin'''''
ABORT BUSY
ABORT ERROR
ABORT 'NO CARRIER'
REPORT CONNECT
TIMEOUT 10
"" "ATZ"
OK AT+CGDCONT=1,"ip","'''''internet'''''"
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "AT+IPR=115200"
OK "ATE1"
TIMEOUT 60
"" "ATD*99***1#"
CONNECT \c
'''Note:''' The above highlighted word(s) ''''''pin'''''' is the PIN of your card (typically a four digit code)<BR>
'''Note:''' The above highlighted word(s) ''''''pin'''''' is the PIN of your card (typically a four digit code)<BR>
'''Note:''' The above highlighted word(s) ''''''internet'''''' is the Access Point Name (APN) of the service you use (for instance mine is "web.omnitel.it"). If you don't know the Internet APN, ask your service provider.<BR>
'''Note:''' The above highlighted word(s) ''''''internet'''''' is the Access Point Name (APN) of the service you use (for instance mine is "web.omnitel.it"). If you don't know the Internet APN, ask your service provider.<BR>
Line 89: Line 76:
  poff serialmodem
  poff serialmodem


= Checks =
= If something goes wrong... =
Check your ttyS0 settings
setserial -ga /dev/ttyS0
Check if process is running
Check if process is running
  ps | grep pppd
  ps | grep pppd
Line 100: Line 85:
pppd seems to have some pppstats function
pppd seems to have some pppstats function
  pppstats
  pppstats
== Check and set serial speed ==
Check your ttyS settings
setserial -ga /dev/ttyS1
You should see something like this:
<pre>
/dev/ttyS1, Line 1, UART: 16550A, Port: 0x02f8, IRQ: 3
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test
</pre>

Revision as of 14:34, 5 January 2011

General notes

Warning: Page is under heavy construction. Do not use unless you know what you are doing! Funtionallity is still unknown.


Requirements

Install alpine-2.1.3 or newer (see these notes if you are unsure how to do it).
And do basic setup (run 'setup-alpine').

Hardware

Choose what ttyS port to use. (In below examples replace ttyS? with the ttyS? that applies for your needs)

  • /dev/ttyS0 is same as COM1
  • /dev/ttyS1 is same as COM2
  • (and so on...)

Install packages

Configure repository

When this article was written, some of the packages was still in 'testing'. So we need to add testing to repository.

echo "http://dl-3.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repository
apk update

Install packages

Install required packages

apk add ppp
apk add setserial

Modules

Load some needed modules and make sure they get automatically loaded at next reboot

modprobe ppp
echo "ppp" >> /etc/modules

Configure

Create configfiles

Note: This is a draft config - it needs fixing

/etc/ppp/peers/serialmodem

/dev/ttyS0
38400
crtscts
modem
noauth
usepeerdns
defaultroute
noipdefault
debug
noccp
nobsdcomp
novj
user "irrelevant"
password "irrelevant"
connect '/usr/sbin/chat -f /etc/ppp/chat-serialmodem'
Note: This is a draft config - it needs fixing

/etc/ppp/chat-serialmodem

ABORT BUSY
ABORT ERROR
ABORT 'NO CARRIER'
REPORT CONNECT
TIMEOUT 10
"" "ATZ"
OK "AT+CPIN=pin"
OK AT+CGDCONT=1,"ip","internet"
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "AT+IPR=115200"
OK "ATE1"
TIMEOUT 60
"" "ATD*99***1#"
CONNECT \c

Note: The above highlighted word(s) 'pin' is the PIN of your card (typically a four digit code)
Note: The above highlighted word(s) 'internet' is the Access Point Name (APN) of the service you use (for instance mine is "web.omnitel.it"). If you don't know the Internet APN, ask your service provider.

Start/Stop

Start connection

pon serialmodem

Stop connection

poff serialmodem

If something goes wrong...

Check if process is running

ps | grep pppd

Logfile would also give you information on what happened

grep pppd /var/log/messages

Check nic information

ifconfig ppp0

pppd seems to have some pppstats function

pppstats

Check and set serial speed

Check your ttyS settings

setserial -ga /dev/ttyS1

You should see something like this:

/dev/ttyS1, Line 1, UART: 16550A, Port: 0x02f8, IRQ: 3
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test