The modem control strings I was trying to use was copied from roughly here, those people work with another distro where sudo used: http://forums.whirlpool.net.au/forum-replies.cfm?r=33180496#r33180496
Below puts the modem to sleep with AT+CFUN=0
sudo echo -e "AT+CFUN=0\r" > /dev/ttyUSB2
suggested testing following, here instead og going to sleep, this a form of activation of the account on the SIM card to go to the net. The basis of the connect.sh
su -c "echo -e "AT!SCACT=1,2\r" > /dev/ttyUSB2"
My initial understanding was, that using sudo or in pclos case using su was so in case a normal user was trying to connect but did not have the right permissions, then the su would overcome obstacle. In the case of only a single user having access to the modem I am in favour of having the permissions to ttyUSBx
right, then no need for su in the script.
When the script failed I started breaking down the line. Below revealed the problem with using double quotes (") or single quotes (') which I fumbled into solving by using \041
instead of !
, while this works you need to understand ACII/hex things, a bit heavy and would really test normal users I think.
[gert@KDE-mini-Cprog ~]$ echo -e "AT\041SCACT=1,2\r"
Having found that following works fine in pclos, the use of the !
[gert@KDE-mini-Cprog ~]$ echo -e 'AT!SCACT=1,2\r'
I got curious and tried without thinking hard enough to run:
su -c "echo -e 'AT!SCACT=1,2\r'"
No permutation of quotes and few other mods gave a result. Finally I came to the conclusion that part of the problem might be that su -
is an operator that ought to call admin password.
[gert@KDE-mini-Cprog ~]$ su -c "echo -e 'AT!SCACT=1,2\r'"
bash: !SCACT=1,2\r'": event not found
To make my life harder, I made some tests of shorter combinations and I did get asked for password, the full line though never got to a stage where it could be tested on the modem. I don't recall if I was in another KDE-mini at the time (I do a bit of skipping between similar KDE-mini versions ) but the present KDE-mini shows no sign of asking for password, only if I use su -
My question: is there something fundamentally wrong with the concept of a command line string like above