Using GNU screen for AT commands
Tim Harvey
tharvey at gateworks.com
Sat May 6 01:07:13 UTC 2017
On Fri, Apr 21, 2017 at 3:39 PM, Tim Harvey <tharvey at gateworks.com> wrote:
> On Fri, Apr 21, 2017 at 2:26 PM, Aleksander Morgado
> <aleksander at aleksander.es> wrote:
>> On Fri, Apr 21, 2017 at 10:38 PM, Tim Harvey <tharvey at gateworks.com> wrote:
>>> That's a useful tool - thanks for the pointer!
>>>
>>> I wonder if this perhaps explains what might be happening:
>>>
>>> root at ventana:~# ./ModemManager/test/mmtty -d /dev/ttyUSB3 -v --no-flash
>>> creating AT capable serial port for device 'ttyUSB3'...
>>> opening serial port...
>>> (ttyUSB3) opening serial port...
>>> (ttyUSB3): setting up baudrate: 57600
>>> (ttyUSB3): port attributes not fully set
>>> (ttyUSB3) device open count is 1 (open)
>>> disabling serial port flash...
>>> ready
>>>> AT
>>> (ttyUSB3): --> 'AT<LF><CR>'
>>> (ttyUSB3): <-- '<CR><LF>ERROR<CR><LF>'
>>> Got failure code 100: Unknown error
>>> Unknown error
>>>> ATI
>>> (ttyUSB3): --> 'ATI<LF><CR>'
>>> (ttyUSB3): <-- '<CR><LF>Manufacturer: Sierra Wireless,
>>> Inc.<CR><LF>Model: MC8790<CR><LF>Revision: K1_0_2_8AP
>>> C:/WS/FW/K1_0_2_8AP/MSM6290/SRC 2008/09/17 14:00:22<CR><LF>IMEI:
>>> 352974021856935<CR><LF>IMEI SV: 3<CR><LF>FSN:
>>> D661380183210<CR><LF>3GPP Release 6<CR><LF>+GCAP:
>>> +CGSM,+DS,+ES<CR><LF><CR><LF><CR><LF>ERROR<CR><LF>'
>>> Got failure code 100: Unknown error
>>> Unknown error
>>
>> This is really weird, are you always getting a ERROR at the end of the
>> ATI response when using mmtty? Does the same happen when using
>> minicom?
>>
>
> yes using mmtty always shows the modem returning ERROR from my AT
> commands with a variety of modems I have here including Sierra
> Wireless MC8790, Sierra Wireless MC7710, Huawei MU609
>
> minicom/screen on my armhf host fail in the same way (I see the echo
> of the commands I enter, but no response like the modem interpreter
> isn't seeing the EOL or like there's a flow control issue). However I
> have found that I can use minicom/screen with the same modems on my
> x86 host just fine. For sanity sake both my x86 host and my armhf host
> are using Ubuntu 16.04 with the Linux 4.4.0-63-generic kernel. I'm
> seeing the same thing on another arm host (completely different SoC
> UART's and ARM CPU core) as well so I don't think its anything to do
> with the SoC UART. One obvious difference is that 'stty -F
> /dev/ttyUSB3' returns a completely different default configuration on
> both hosts (with ModemManager not running when modem is enumerated) -
> not sure why:
>
> on the x86_64 host:
> tharvey at x86_64:$ uname -a
> Linux tharvey 4.4.0-63-generic #84-Ubuntu SMP Wed Feb 1 17:20:32 UTC
> 2017 x86_64 x86_64 x86_64 GNU/Linux
> tharvey at x86_64:$ service ModemManager stop
> ... insert modem
> tharvey at x86_64:$ stty -F /dev/ttyUSB3
> speed 9600 baud; line = 0;
> kill = ^H; min = 100; time = 2;
> -icrnl -imaxbel
> -opost -onlcr
> -isig -icanon -echo
>
> on the armhf host:
> root at armhf:~# uname -a
> Linux ventana 4.4.0-63-generic #84-Ubuntu SMP Wed Feb 1 17:19:57 UTC
> 2017 armv7l armv7l armv7l GNU/Linux
> root at armhf:~# service ModemManager stop
> [ 567.028250] usb 1-1.4.5: new high-speed USB device number 5 using ci_hdrc
> [ 567.139580] usb 1-1.4.5: New USB device found, idVendor=1199, idProduct=683c
> [ 567.146712] usb 1-1.4.5: New USB device strings: Mfr=2, Product=1,
> SerialNumber=0
> [ 567.154264] usb 1-1.4.5: Product: Mini Card
> [ 567.158496] usb 1-1.4.5: Manufacturer: Sierra Wireless, Incorporated
> [ 567.247315] usbcore: registered new interface driver usbserial
> [ 567.253387] usbcore: registered new interface driver usbserial_generic
> [ 567.263496] usbserial: USB Serial support registered for generic
> [ 567.285120] usbcore: registered new interface driver sierra
> [ 567.290852] usbserial: USB Serial support registered for Sierra USB modem
> [ 567.297856] sierra 1-1.4.5:1.0: Sierra USB modem converter detected
> [ 567.305569] usb 1-1.4.5: Sierra USB modem converter now attached to ttyUSB0
> [ 567.312722] sierra 1-1.4.5:1.1: Sierra USB modem converter detected
> [ 567.320194] usb 1-1.4.5: Sierra USB modem converter now attached to ttyUSB1
> [ 567.327348] sierra 1-1.4.5:1.2: Sierra USB modem converter detected
> [ 567.334661] usb 1-1.4.5: Sierra USB modem converter now attached to ttyUSB2
> [ 567.341826] sierra 1-1.4.5:1.3: Sierra USB modem converter detected
> [ 567.349159] usb 1-1.4.5: Sierra USB modem converter now attached to ttyUSB3
> [ 567.356366] sierra 1-1.4.5:1.4: Sierra USB modem converter detected
> [ 567.363753] usb 1-1.4.5: Sierra USB modem converter now attached to ttyUSB4
> [ 567.370906] sierra 1-1.4.5:1.5: Sierra USB modem converter detected
> [ 567.378232] usb 1-1.4.5: Sierra USB modem converter now attached to ttyUSB5
> [ 567.385385] sierra 1-1.4.5:1.6: Sierra USB modem converter detected
> [ 567.392752] usb 1-1.4.5: Sierra USB modem converter now attached to ttyUSB6
>
> root at armhf:~# stty -F /dev/ttyUSB3
> speed 9600 baud; line = 0;
> -brkint -imaxbel
>
>
> I am getting the same error returned on from my AT commands via mmtty
> on the x86 host as well. Is there perhaps a bug with mmtty? I still
> think its something to do with the modem's interpreter not liking the
> CRLF.
>
> Note that even though ModemManager's mmtty shows those errors,
> ModemManager itself seems to work on both systems:
> tharvey at x86_64:/usr/src/ModemManager$ ./test/mmtty -d /dev/ttyUSB3 -v --no-flash
> creating AT capable serial port for device 'ttyUSB3'...
> opening serial port...
> (ttyUSB3) opening serial port...
> (ttyUSB3): setting up baudrate: 57600
> (ttyUSB3): port attributes not fully set
> (ttyUSB3) device open count is 1 (open)
> disabling serial port flash...
> ready
>> AT
> (ttyUSB3): --> 'AT<LF><CR>'
> (ttyUSB3): <-- '<CR><LF>ERROR<CR><LF>'
> Got failure code 100: Unknown error
> Unknown error
>> ATI
> (ttyUSB3): --> 'ATI<LF><CR>'
> (ttyUSB3): <-- '<CR><LF>Manufacturer: Sierra Wireless,
> Inc.<CR><LF>Model: MC8790<CR><LF>Revision: K1_0_2_8AP
> C:/WS/FW/K1_0_2_8AP/MSM6290/SRC 2008/09/17 14:00:22<CR><LF>IMEI:
> 352974021856935<CR><LF>IMEI SV: 3<CR><LF>FSN:
> D661380183210<CR><LF>3GPP Release 6<CR><LF>+GCAP:
> +CGSM,+FCLASS,+DS<CR><LF><CR><LF><CR><LF>ERROR<CR><LF>'
> Got failure code 100: Unknown error
> Unknown error
>> ^Ccancelling the main loop...
>
> (ttyUSB3) device open count is 0 (close)
> (ttyUSB3) closing serial port...
> (ttyUSB3) serial port closed
> (ttyUSB3) forced to close port
> tharvey at x86_64:/usr/src/ModemManager$ mmcli -L
>
> Found 1 modems:
> /org/freedesktop/ModemManager1/Modem/0 [Sierra Wireless, Inc.] MC8790
>
> tharvey at tharvey:/usr/src/ModemManager$ mmcli -m 0
>
> /org/freedesktop/ModemManager1/Modem/0 (device id
> 'ff59fbd17f14954040b1c2f581340d4ec9bdf054')
> -------------------------
> Hardware | manufacturer: 'Sierra Wireless, Inc.'
> | model: 'MC8790'
> | revision: 'K1_0_2_8AP
> C:/WS/FW/K1_0_2_8AP/MSM6290/SRC 2008/09/17 14:00:22'
> | supported: 'gsm-umts'
> | current: 'gsm-umts'
> | equipment id: '352974021856935'
> -------------------------
> System | device: '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-3'
> | drivers: 'sierra'
> | plugin: 'Sierra (legacy)'
> | primary port: 'ttyUSB3'
> | ports: 'ttyUSB3 (at), ttyUSB4 (at), ttyUSB5
> (at), ttyUSB6 (at)'
> -------------------------
> Numbers | own : 'unknown'
> -------------------------
> Status | lock: 'unknown'
> | unlock retries: 'unknown'
> | state: 'failed'
> | failed reason: 'sim-missing'
> | power state: 'off'
> | access tech: 'unknown'
> | signal quality: '0' (cached)
> -------------------------
> Modes | supported: 'allowed: 2g; preferred: none
> | allowed: 3g; preferred: none
> | allowed: 2g, 3g; preferred: none
> | allowed: 2g, 3g; preferred: 2g
> | allowed: 2g, 3g; preferred: 3g'
> | current: 'allowed: any; preferred: none'
> -------------------------
> Bands | supported: 'unknown'
> | current: 'unknown'
> -------------------------
> IP | supported: 'ipv4, ipv6'
> -------------------------
> SIM | path: 'none'
>
> -------------------------
> Bearers | paths: 'none'
Aleksander,
I finally got back to this today and now I feel rather silly. This was
due to me using screen within a screen session in which case screen
starts translating CR to LF and LF to CR. Because modems use CR as the
line termination character the lines were never terminated because
screen within a screen session would send a LF every time I hit CR.
Tim
More information about the libqmi-devel
mailing list