Thanks for your suggestion.
But it still not work.
I do some test below.
test1.
I add "exec /usr/local/startdial.sh $symlinkName & "
in /lib/udev/usb_modeswitch line 617(before "return $symlinkName").
But this action will cause /dev/gsmmodem not be created.
Is it because of that exec will create new process and replace current process?
So current script could not return "gsmmodem" to udev?
test2.
I create a shell script /home/alextu/temp/test2.sh.
"
#!/bin/bash
for i in $(seq 1 100)
do
echo "test2...." > /home/alextu/temp/testlog
sleep 1
done
"
Then I add "/home/alextu/temp/test2.sh &" in line 617.
Then replug-in C170, but /dev/gsmmodem still not be created.
Normally test2.sh should fork a new process and run in background.
I don't understand this situation.....
And could you teach me how to debug in usb_modeswitch script,please?
I try to modify "set logging 1" in line 27, but it not work.
And this action will casuse /dev/gsmmodem not be created, too.
But it still not work.
I do some test below.
test1.
I add "exec /usr/local/startdial.sh $symlinkName & "
in /lib/udev/usb_modeswitch line 617(before "return $symlinkName").
But this action will cause /dev/gsmmodem not be created.
Is it because of that exec will create new process and replace current process?
So current script could not return "gsmmodem" to udev?
test2.
I create a shell script /home/alextu/temp/test2.sh.
"
#!/bin/bash
for i in $(seq 1 100)
do
echo "test2...." > /home/alextu/temp/testlog
sleep 1
done
"
Then I add "/home/alextu/temp/test2.sh &" in line 617.
Then replug-in C170, but /dev/gsmmodem still not be created.
Normally test2.sh should fork a new process and run in background.
I don't understand this situation.....
And could you teach me how to debug in usb_modeswitch script,please?
I try to modify "set logging 1" in line 27, but it not work.
And this action will casuse /dev/gsmmodem not be created, too.
First, you might want to try version 1.1.3 and data version 20100623; the C170 is included now.
I recommend to feed the command to the tcl shell by running "tclsh" and then pasting the line on the prompt:This will test if the path is OK and the script starts executing.
You must make sure that line executes without any error; you won't get any error feedback from udev if the script fails.CCTU wrote:test1.
I add "exec /usr/local/startdial.sh $symlinkName & "
in /lib/udev/usb_modeswitch line 617(before "return $symlinkName").
But this action will cause /dev/gsmmodem not be created.
I recommend to feed the command to the tcl shell by running "tclsh" and then pasting the line on the prompt:
Code: Select all
% exec /usr/local/startdial.sh ttyUSB0 &
A look onto the usb_modeswitch documentation page would help a great deal. See "Troubleshooting".CCTU wrote:And could you teach me how to debug in usb_modeswitch script, please?
I try to modify "set logging 1" in line 27, but it not work.
Last edited by Josh on 10 Jul 2010, 19:52, edited 1 time in total.
I tested my script in tclsh and it is ok.
This is the script file.
http://dl.dropbox.com/u/2495108/startdial.sh
This is the log. to /lib/udev/usb_modeswitch before , gsmmodem will never created.
This is the file I modified.
http://dl.dropbox.com/u/2495108/usb_modeswitch_modified
This is the logfile created by startdial.sh.
so usb_modeswitch could not
It says
Could you help me again, please?
This is the script file.
http://dl.dropbox.com/u/2495108/startdial.sh
This is the log.
But when I add a line"
alextu@alextu-nb:/usr/bin$ sudo tclsh
% exec ./startdial.sh ttyUSB3 &
5421
% --> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: AT+CGDCONT=1,"ip","internet"
AT+CGDCONT=1,"ip","internet"
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT*99***#
--> Waiting for carrier.
ATDT*99***#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Sat Jul 10 01:00:18 2010
--> Pid of pppd: 5425
--> Using interface ppp0
--> local IP address 112.78.70.226
--> remote IP address 202.144.208.130
--> primary DNS address 168.95.1.1
--> secondary DNS address 168.95.192.1
"
Code: Select all
exec /usr/bin/startdial.sh $symlinkName &
Code: Select all
return $symlinkName
This is the file I modified.
http://dl.dropbox.com/u/2495108/usb_modeswitch_modified
This is the logfile created by startdial.sh.
I think this is because of "exec" will replace the current process(/lib/udev/usb_modeswitch),"
alextu@alextu-nb:~/scripts$ tail -f diallog
dial up on /dev/gsmmodem......
/dev/gsmmodem does not exist....
/dev/gsmmodem does not exist....
/dev/gsmmodem does not exist....
/dev/gsmmodem does not exist....
/dev/gsmmodem does not exist....
/dev/gsmmodem does not exist....
/dev/gsmmodem does not exist....
/dev/gsmmodem does not exist....
"
so usb_modeswitch could not
The infomation is in "Example 15-24. Effects of exec" in http://tldp.org/LDP/abs/html/internal.html#EX54return $symlinkName(gsmmodem) to /lib/udev/rules.d/40-usb_modeswitch.rules line 11.Code: Select all
KERNEL=="ttyUSB*", PROGRAM="/usr/bin/tclsh /lib/udev/usb_modeswitch symlink name %p", SYMLINK="%c"
It says
I have no idea about how to avoid blocking original script(usb_modeswitch)."exec,this shell builtin replaces the current process with a specified command."
Could you help me again, please?
The "exec" command in Tcl is different from the Bash command with the same name. In Tcl you always need it to launch any external program, script or no script. And the "&" operator makes the execution independent from the calling script, it will not be blocked.
I can see no real error in your modifications. One thing worth trying is to explicitly add the interpreting program for the script:
I can see no real error in your modifications. One thing worth trying is to explicitly add the interpreting program for the script:
Code: Select all
exec /bin/sh /usr/bin/startdial.sh $symlinkName &
The same situation,it still not create gsmmodem in /dev after I add
in /lib/udev/usb_modeswitch line 618.
Then after I kill the process
So I think usb_modeswitch is blocked by my script.
Could it work on your side?
Code: Select all
exec /bin/sh /usr/bin/startdial.sh $symlinkName &
Then after I kill the process
/dev/gsmmodem created!!root 2867 1 0 20:03 ? 00:00:00 /bin/sh /usr/bin/startdial.sh gsmmodem
So I think usb_modeswitch is blocked by my script.
Could it work on your side?
Josh wrote:The "exec" command in Tcl is different from the Bash command with the same name. In Tcl you always need it to launch any external program, script or no script. And the "&" operator makes the execution independent from the calling script, it will not be blocked.
I can see no real error in your modifications. One thing worth trying is to explicitly add the interpreting program for the script:Code: Select all
exec /bin/sh /usr/bin/startdial.sh $symlinkName &
Excuse me, is there someone meet the same situation like me?
If someone could auto dial to 3.5G by this usb_modeswitch utility?
If someone could auto dial to 3.5G by this usb_modeswitch utility?
CCTU wrote:The same situation,it still not create gsmmodem in /dev after I addin /lib/udev/usb_modeswitch line 618.Code: Select all
exec /bin/sh /usr/bin/startdial.sh $symlinkName &
Then after I kill the process/dev/gsmmodem created!!root 2867 1 0 20:03 ? 00:00:00 /bin/sh /usr/bin/startdial.sh gsmmodem
So I think usb_modeswitch is blocked by my script.
Could it work on your side?
Josh wrote:The "exec" command in Tcl is different from the Bash command with the same name. In Tcl you always need it to launch any external program, script or no script. And the "&" operator makes the execution independent from the calling script, it will not be blocked.
I can see no real error in your modifications. One thing worth trying is to explicitly add the interpreting program for the script:Code: Select all
exec /bin/sh /usr/bin/startdial.sh $symlinkName &