Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
0
answers
63
views
pon will fail in startup but sending AT commands directly with minicom won't
I have a SIM LTE modem that use "pon" to connect. This pon use a chat script that send the AT commands needed to connect. when I try to start the ppp service, the AT commands all fail by timeout: ``` pi@raspberrypi:~ $ sudo pon pppd options in effect: debug # (from /etc/ppp/peers/provider) updetach...
I have a SIM LTE modem that use "pon" to connect. This pon use a chat script that send the AT commands needed to connect.
when I try to start the ppp service, the AT commands all fail by timeout:
pi@raspberrypi:~ $ sudo pon
pppd options in effect:
debug # (from /etc/ppp/peers/provider)
updetach # (from /etc/ppp/peers/provider)
persist # (from /etc/ppp/peers/provider)
dump # (from /etc/ppp/peers/provider)
noauth # (from /etc/ppp/peers/provider)
remotename 3gppp # (from /etc/ppp/peers/provider)
/dev/ttyUSB3 # (from /etc/ppp/peers/provider)
115200 # (from /etc/ppp/peers/provider)
lock # (from /etc/ppp/peers/provider)
connect chat -s -v -f /etc/chatscripts/chat-connect -T internet.x # (from /etc/ppp/peers/provider)
disconnect chat -s -v -f /etc/chatscripts/chat-disconnect # (from /etc/ppp/peers/provider)
nocrtscts # (from /etc/ppp/peers/provider)
modem # (from /etc/ppp/peers/provider)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/provider)
novj # (from /etc/ppp/peers/provider)
novjccomp # (from /etc/ppp/peers/provider)
ipcp-accept-local # (from /etc/ppp/peers/provider)
ipcp-accept-remote # (from /etc/ppp/peers/provider)
ipparam 3gppp # (from /etc/ppp/peers/provider)
noipdefault # (from /etc/ppp/peers/provider)
ipcp-max-failure 30 # (from /etc/ppp/peers/provider)
defaultroute # (from /etc/ppp/peers/provider)
usepeerdns # (from /etc/ppp/peers/provider)
noccp # (from /etc/ppp/peers/provider)
noipx # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
alarm
Failed
Script chat -s -v -f /etc/chatscripts/chat-connect -T internet.x finished (pid 2017), status = 0x3
Now, If I run all the commands that are preset in the **/etc/chatscripts/chat-connect** script using minicom, the answer for those commands are instant:
pi@raspberrypi:~ $ sudo minicom -D /dev/ttyUSB3 -b 115200
Welcome to minicom 2.8
OPTIONS: I18n
Port /dev/ttyUSB3, 16:08:09
Press CTRL-A Z for help on special keys
AT
OK
ATE0
OK
AT+CPIN?
+CPIN: READY
OK
AT+CSQ
+CSQ: 16,99
OK
AT+CREG?
+CREG: 0,5
OK
AT+CGREG?
+CGREG: 0,5
OK
AT+COPS?
+COPS: 0,0,"XXX",0
OK
AT+CGDCONT=1,"IP","internet.x",,0,0
OK
ATD*99#
CONNECT 150000000
There are no delays, no waits. The OK are received instantly. Not sure what is happening. I still don't see the ppp0 connection with ifconfig tho.
Mariano L
(123 rep)
Aug 15, 2024, 11:34 PM
0
votes
1
answers
214
views
Facing difficulties sending bytes containing white spaces python irc bot
Trying to make a basic irc bot in python (3.9.2) that can response specific commands when invoked. It works although when a response contains whitespace or a space, only the first word gets displayed by the bot, for example; ``` me > @hello bot > hi me > @how is the weather? bot > the ``` it was sup...
Trying to make a basic irc bot in python (3.9.2) that can response specific commands when invoked. It works although when a response contains whitespace or a space, only the first word gets displayed by the bot, for example;
me > @hello
bot > hi
me > @how is the weather?
bot > the
it was supposed to say, the weather seems nice today
Here's the code
import sys
import time
import socket
import string
server_address="irc.libera.chat"
server_port = 6667
botnick="lamebot"
channel_name="##megadouched"
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
irc.connect((server_address,server_port))
irc.setblocking(False)
time.sleep(1)
irc.send(bytes("USER "+botnick+" "+botnick+" "+botnick+" bot has joined the chat\r\n", "UTF-8"))
time.sleep(1)
irc.send(bytes("NICK "+botnick+"\n", "UTF-8"))
time.sleep(1)
irc.send(bytes("JOIN "+channel_name+"\n", "UTF-8"))
irc_privmsg = 'b"PRIVMSG "+channel_name+" Hello\r\n"'
while True:
try:
text = irc.recv(4096)
except Exception:
pass
if text.find(bytes(":@hi", "UTF-8"))!=-1:
irc.sendall(bytes("PRIVMSG "+channel_name+" Hello\r\n", "UTF-8"))
text=b""
elif text.find(bytes(":@how is the weather?", "UTF-8"))!=-1:
irc.sendall(bytes("PRIVMSG "+channel_name+" the weather today seems nice\r\n", "UTF-8"))
text=b""
input()
atheros
(256 rep)
Jul 19, 2022, 01:56 PM
• Last activity: Jul 19, 2022, 06:18 PM
1
votes
1
answers
3290
views
Execute command before bringing interface up on OpenWRT
I'm making a Wireless-to-3g router with openwrt, and its working pretty well. To bring the 3g-wan interface up, I have to first register the USB modem using the command: gcom -d /dev/ttyUSB0 If I don't do this, `chat` will fail to establish connection with `modem not registered` errors. **My questio...
I'm making a Wireless-to-3g router with openwrt, and its working pretty well. To bring the 3g-wan interface up, I have to first register the USB modem using the command:
gcom -d /dev/ttyUSB0
If I don't do this,
chat
will fail to establish connection with modem not registered
errors.
**My question**: Is there an option similar to pre-up
on Debian to execute things before bringing an interface up, and only bring this up after successfully reaching this condition? Why? Because putting the gcom
command on /etc/rc.local
seems not to work, and it isn´t elegant.
My current wan
interface configuration:
config interface 'wan'
# === Conexão com a 3G da tim
# option ifname ppp0
option ifname 3g-wan
option username tim
option password tim
option pincode XXXX
option proto 3g
option service umts
option device /dev/ttyUSB0
option dialnumber '*99***1#'
option apn tim.br
This solution must have an out-of-the-box experience because, after configured we deliver those boxes to users to create "remote offices" on distant places.
user34720
Dec 22, 2015, 04:37 PM
• Last activity: Feb 6, 2018, 06:28 PM
3
votes
1
answers
1637
views
chat source code
Is the source code of `chat` program (used for dialog with modem) open? If it is so, where can I find it? I've been trying find it, but no success.
Is the source code of
chat
program (used for dialog with modem) open? If it is so, where can I find it? I've been trying find it, but no success.
Renat Zaripov
(395 rep)
Dec 23, 2012, 03:10 PM
• Last activity: Sep 27, 2016, 11:23 PM
2
votes
1
answers
1196
views
What is the relationship between wvdial, pon and chat?
I've checked their man pages, but I'm still confused. I just know they are all related to `ppp` connections. I'm surprised that when I googled "pon wvdial relationship", I get no useful results, so I ask this question here. Who can tell me the role of these three tools? I still feel they do the same...
I've checked their man pages, but I'm still confused. I just know they are all related to
ppp
connections.
I'm surprised that when I googled "pon wvdial relationship", I get no useful results, so I ask this question here.
Who can tell me the role of these three tools? I still feel they do the same thing... and... I find that a new tool - pon.wvdial
has come out, and what is it?
I'm really confused with these tools...
cifer
(631 rep)
Jan 11, 2014, 03:27 PM
• Last activity: Sep 27, 2016, 10:33 PM
2
votes
0
answers
2966
views
dbclient - login without manually typing password
On my router which runs OpenWRT I need a script which will keep a SSH connection alive mostly all the time (small breaks are OK). As the SSH server which I want to connect to takes care of multiple connections from the same user, it is enough if I put the script to `cron` config file. There are two...
On my router which runs OpenWRT I need a script which will keep a SSH connection alive mostly all the time (small breaks are OK). As the SSH server which I want to connect to takes care of multiple connections from the same user, it is enough if I put the script to
cron
config file.
There are two problems:
* Installing stuff is not easy there (very limited space, many packages need to be compiled by me before I even try if it works).
* The server to which I want to connect does not respect RSA keys.
As my router uses [dropbear](http://linux.die.net/man/1/dbclient) , I tried the following strategies:
- defining DROPBEAR_PASSWORD
- defining SSH_ASKPASS_ALWAYS and SSH_ASKPASS
- definig SSH_ASKPASS and DISPLAY
- small [chat](http://linux.die.net/man/8/chat) script - no idea if it was OK, posting it below.
- `ssh login@machine
-l
-t Allocate a pty
-T Don't allocate a pty
-N Don't run a remote command
-f Run in background after auth
-y Always accept remote host key if unknown
-y -y Don't perform any remote host key checking (caution)
-s Request a subsystem (use by external sftp)
-i (multiple allowed)
-A Enable agent auth forwarding
-L Local port forwarding
-g Allow remote hosts to connect to forwarded ports
-R Remote port forwarding
-W (default 24576, larger may be faster, max 1MB)
-K (0 is never, default 0)
-I (0 is never, default 0)
-J Use program pipe rather than TCP connection
-c Specify preferred ciphers ('-c help' to list options)
-m Specify preferred MACs for packet verification (or '-m help')
-V Version
chat
script:
assword: mypassword123
ash
script:
chat -f scriptfile &
ssh login@machine
My router's shell is ash
.
I read that this kind of problem is solved by expect
, but I doubt I will have enough space on my router for it's depencencies - currently I have 300kB space left on my router, but I could somehow reclaim up to 512kB.
How do I make it connect?
styrofoam fly
(512 rep)
Oct 22, 2014, 05:56 PM
• Last activity: Sep 27, 2016, 10:08 PM
3
votes
2
answers
7492
views
Difficulties to establish a ppp connection to a GSM provider
I want to establish a `ppp` link to a GSM provider with my cell phone modem. The modem gets recognized and I can send AT commands just fine, but I can not get the connection established. My `chat` script looks like: ####################################### SAY 'Setting the abort string\n' SAY '\n' #...
I want to establish a
ppp
link to a GSM provider with my cell phone modem. The modem gets recognized and I can send AT commands just fine, but I can not get the connection established.
My chat
script looks like:
#######################################
SAY 'Setting the abort string\n'
SAY '\n'
# Abort String ------------------------------
ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT 'NO CARRIER' ABORT DELAYED
#######################################
SAY 'Initializing modem\n'
# Modem Initialization
'' AT
OK ATZ
#######################################
SAY '\n'
SAY 'Setting APN\n'
# Access Point Name (APN)
# Incorrect APN or CGDCONT can often cause errors in connection.
# Below are a bunch of different popular APNs
#REG:\s1 AT+cgdcont=1,"IP","proxy"
#OK 'AT+CGDCONT=0,"IP","proxy"'
#OK 'AT+CGDCONT=1,"IP","proxy"'
#OK 'AT+CGDCONT=2,"IP","proxy"'
OK 'AT+CGDCONT=1,"IP","m2mstatic.apn"'
#OK 'AT+CGDCONT=1,"IP","ISP.TELUS.COM"'
#OK 'AT+CGDCONT=1,"IP","INTERNET.COM"'
#OK 'AT+CGDCONT=1,"IP","ISP.CINGULAR"'
#OK 'AT+CGDCONT=2,"IP","ISP.CINGULAR"'
""
And in /var/log/messages
I get the following messages:
Jan 11 04:08:49 ariag25 pppd: pppd 2.4.5 started by root, uid 0
Jan 11 04:08:50 ariag25 chat: abort on (NO DIAL TONE)
Jan 11 04:08:50 ariag25 chat: abort on (NO ANSWER)
Jan 11 04:08:50 ariag25 chat: abort on (NO CARRIER)
Jan 11 04:08:50 ariag25 chat: abort on (DELAYED)
Jan 11 04:08:50 ariag25 chat: send (AT^M)
Jan 11 04:08:50 ariag25 chat: expect (OK)
Jan 11 04:08:50 ariag25 chat: AT^M^M
Jan 11 04:08:50 ariag25 chat: OK
Jan 11 04:08:50 ariag25 chat: -- got it
Jan 11 04:08:50 ariag25 chat: send (ATZ^M)
Jan 11 04:08:51 ariag25 chat: expect (OK)
Jan 11 04:08:51 ariag25 chat: ^M
Jan 11 04:08:51 ariag25 chat: ATZ^M^M
Jan 11 04:08:51 ariag25 chat: OK
Jan 11 04:08:51 ariag25 chat: -- got it
Jan 11 04:08:51 ariag25 chat: send (AT+CGDCONT=1,"IP","m2mstatic.apn"^M)
Jan 11 04:08:51 ariag25 chat: expect (OK)
Jan 11 04:08:51 ariag25 chat: ^M
Jan 11 04:08:51 ariag25 chat: AT+CGDCONT=1,"IP","m2mstatic.apn"^M^M
Jan 11 04:08:51 ariag25 chat: OK
Jan 11 04:08:51 ariag25 chat: -- got it
Jan 11 04:08:51 ariag25 chat: send (ATDT*99#^M)
Jan 11 04:08:51 ariag25 chat: expect (CONNECT)
Jan 11 04:08:51 ariag25 chat: ^M
Jan 11 04:08:51 ariag25 chat: ATDT*99#^M^M
Jan 11 04:08:51 ariag25 chat: CONNECT
Jan 11 04:08:51 ariag25 chat: -- got it
Jan 11 04:08:51 ariag25 chat: send (^M)
Jan 11 04:08:51 ariag25 pppd: Serial connection established.
###Edit
I don't think things are wrong with my chat script but my modem instead. Notice that on the bottom of the messages, the context switched from chat
to pppd
- why is that? May my power supply be too weak? That's what I suspect now. Any ideas?
Also, if I do a killall pppd
after this and try to connect with screen
screen /dev/modem 9600
the modem doesn't reply anymore until I power cycle it.
However, I'm surprised! I hooked it up to a 2.1A USB power supply.
###Edit2
My /etc/ppp/options
looks like:
debug
/dev/ttyUSB1
9600
modem
crtscts
lock
connect /etc/ppp/net-connect
asyncmap 0
defaultroute
and /etc/ppp/peers/provider
like this:
connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99***1#"
# Serial device to which the modem is connected.
/dev/modem
# Speed of the serial line.
9600
# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route.
defaultroute
# Makes pppd "dial again" when the connection is lost.
persist
# Do not ask the remote to authenticate.
noauth
stdcerr
(2099 rep)
Jan 7, 2014, 04:08 AM
• Last activity: Sep 27, 2016, 09:53 PM
Showing page 1 of 7 total questions