OpenWrt Forum Archive

Topic: How to get gsm signal strenght without ifdown gsm

The content of this topic has been archived on 1 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello!

I have a gsm module and I would like to read the signal strenght (rssi). According with this page: http://wiki.openwrt.org/doc/recipes/3gd … leshooting I can do it with the command gcom -d /dev/ttyUSB0 sig

But when I type this command and the interface gsm is up, it prints:

root@OpenWrt:~# gcom -d /dev/ttyUSB0 sig
comgt 14:49:32 -> -- Error Report --
comgt 14:49:32 -> ---->                    ^
comgt 14:49:32 -> Error @133, line 8, Could not write to COM device. (1)


So I need to type ifdown gsm and it works.

root@OpenWrt:~# ifdown gsm
root@OpenWrt:~# gcom -d /dev/ttyUSB0 sig
Signal Quality: 13,99


My problem is: the gsm is the only internet connection my device has.
I was thinking putting in my ash script something like this:

ifdown gsm && gcom -d /dev/ttyUSB0 sig | myprogram && ifup gsm && /etc/init.d/openvpn restart

But I don't want to disable the interface to enable it again and risk loosing the connection to my vpn, I don't think it is a good idea.


Is there another way to get the signal strengh?

Any help or indications of where I can find more informations will be more then welcome.

Thanks

Hi helen,

i dont use any usb-device but i'm using an internal sim-card-module (Telit).
Working on a project with openwrt for about 6 months now and last week i phoned and mailed with telit company about exactly your problem.

They suggested three options:
1) you can turn your usb-device into "suspended" mode --> still same error
2) buy a module where this is possible out-of-the-box (costs quite much)
3) realize it due a software (they offerd me to program it... but for money i cant afford smile  )

If u got something helpful  pls let me know. I am down with my ideas (at the moment i "solved" the problem like u did - interface down | read | if up)

Helen, all depend module, some modules have more then one interface. for example one for Internet connection, one for control, for GPS. What module do you have?

Rindolino, I have experience with different Telit modules, new series have USB interface and gives more then one interface, old series there only one serial port support cmuxd, that create 4 logical ports.

I think it's possibly because of port already opened with some process. Try to find it out with lsof. Modern usb modem have two or three ports, one for modem interface, one for diag interface. Maybe you can use ttyUSB1(2) if any?

(Last edited by hackru on 2 Jul 2014, 16:54)

In the lsof it show just ttyUSB0:
pppd      19011        root   10u      CHR      188,0      0t0 31490 /dev/ttyUSB0

But actually it has a ttyUSB0 and ttyUSB1 that apears when I turn the modem on, but I can not use ttyUSB1. Even when the gsm interface is down, I can use ttyUSB0 but not ttyUSB1, I don't know why.

Normally, there are more than one tty serials for 3g dongle. One for serial data transfers, one for debugging, and one for controlling (as you can dial ussd commands on your Android phone when your data connection is active).

When the ttyUSB0 is up, it's locked by ppp daemon. Any access attempt from other programs to it will be denied.
Try accessing ttyUSB1 or ttyUSB2 in such case. One of the interface should be a control interface.

What revision of OpenWrt are you using?
It's worth upgrading to the latest version of trunk to see if you could have more ttyUSB interface.

I can't use ttyUSB1 even if the daemon is down and I don't have ttyUSB2, I'll try to update my OpenWRT

The version I am using:

root@OpenWrt:~# uname -a
Linux OpenWrt 3.8.6 #23 SMP Wed Apr 16 15:28:05 CEST 2014 armv6l GNU/Linux
root@OpenWrt:~# cat /etc/banner
  _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
-----------------------------------------------------
BARRIER BREAKER (Bleeding Edge, r36311)
-----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
-----------------------------------------------------

The discussion might have continued from here.