Author |
Post |
|
#1 Wed Jan 16, 2013 13:43, 144 months ago.
|
Member
Registered: Jan 2013
Location: Bolzano, Italy
|
Hello, I need to send AT commands (from an external tool) to the modem while smstools is working. There is a lock mechanism on serial device for avoid conflicts reading/writing?
thanks,
Luca
|
|
#2 Wed Jan 16, 2013 23:13, 144 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
In Unix there is no generic lock mechamism, and because of this smstools3 has some regular_run_* settings. See the setting regular_run_cmdfile and other related settings too. With those features you can send your external commands and get the results. For example, if saldo of prepaid SIM is needed, this sample can do it: Sample config and script for regular_run and balance of prepaid SIM using USSD.
|
|
#3 Thu Jan 17, 2013 20:45, 144 months ago.
|
Member
Registered: Jan 2013
Location: Bolzano, Italy
Topic owner
|
no there is no generic mechanism but some applications like minicom creates a lock file in /var/lock for avoid concurrent access. Yes I already use regular_run_cmdfile but for my purpose is not usable: the command I need to send are 'custom' at command that haves different parameters at each call and the client needs to make this calls synchronous.
A simple idea could be: 1) at each access to serial device, a lock file is created. when the access is terminated the lock will be removed; 2) if a lock file is present, the client (see point 3) or smsd should wait (with an optional timeout) until the lock is removed; 3) in the smstools package an small client will be provided for to make access to the serial device with the lock mechanism;
an more elegant alternative would be create an additional serial device that process the IO with the locking support but I don't now how to do this :-)
|
|
#4 Thu Jan 17, 2013 21:20, 144 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
I think I will not implement any lock files. The idea is simple, but: no.
If you have a code which can communicate with a modem, you could check if regular_run with regular_run_interval can be used. Regular_run defines an external program which is executed periodically. While executing, a modem is closed and can be used.
|