Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In Linux (Ubuntu) I am trying to send AT commands to a modem at /dev/ttyACM0. I tried to do it as:

sudo socat - /dev/ttyACM0

but when typing anything I just get a line repeating this command (I expect an OK).

When I do

sudo minicom modem1

it seems to work. I type an AT and get an OK. I type some crap, I get an ERROR.

It seems that modem1 for minicom is somehow configured to use the modem at /dev/ttyACM0.

How can I use socat to send AT commands? Do I need to configure something? Maybe I can use configurations for modem1 of minicom (I do not know how to find/see this configuration)?

Additional information

Is the given socat command correct? Should I play with some options? With the -v option I see the following:

AT
> 2013/10/23 17:10:28.917413  length=3 from=0 to=2
AT
< 2013/10/23 17:10:28.921598  length=3 from=0 to=2
AT
AT
ksjdhfjdgfhjkdfh
> 2013/10/23 17:10:30.244923  length=17 from=3 to=19
ksjdhfjdgfhjkdfh
< 2013/10/23 17:10:30.251383  length=29 from=3 to=31
ksjdhfjdgfhjk\b \bd\b \bf\b \bh\b \b
ksjdhfjdgfhj 

The device itself is found with the following dmesg output:

[5983726.808063] usb 2-1: USB disconnect, device number 3
[5983730.800021] usb 2-1: new full-speed USB device number 4 using uhci_hcd
[5983730.920014] usb 2-1: device descriptor read/64, error -71
[5983733.629524] usb 2-1: New USB device found, idVendor=0572, idProduct=1329
[5983733.629533] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[5983733.629539] usb 2-1: Product: USB Modem
[5983733.629544] usb 2-1: Manufacturer: Conexant
[5983733.629549] usb 2-1: SerialNumber: 24680246
[5983733.632673] cdc_acm 2-1:1.0: ttyACM0: USB ACM device

And the tty is configured as follows:

speed 57600 baud; line = 0;
eof = ^A; min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -echo -echoe
share|improve this question
    
maybe you can get it working playing with these TERMIOS options but I never checked. –  Alex Oct 23 '13 at 14:11
    
Search through this website looking for "socat modem" there are 5 hits, see if any of them are helpful. I do not have a setup to try these out on so I can't really help beyond that. (unix.stackexchange.com/search?q=socat+modem) –  slm Oct 23 '13 at 14:32
    
The hints are not useful. I seem to have a real basic problem, because socat should work. It worked before. But I do not know what the problem is. Is the above command correct is my first question. –  Alex Oct 23 '13 at 15:03
    
This may help Serial-port thermal printer communication –  Sneetsher May 2 at 19:28

1 Answer 1

I came across this Chromium project post that shows what you want. It's titled: Debugging a cellular modem.

excerpt from that page

Communicating directly with a modem with the AT command set

Most modems support AT commands which control the modem and query for information. On a Chromium OS device with the developer mode enabled, you can use the socat command to communicate with the modem. You need a Chromium OS device with a test image installed (or you can use gmerge socat if you are familiar with the dev server) . For example:

  • Type CTRL+ALT+T to enter the crosh shell.
  • Type shell to enter the bash shell.
  • Figure you which USB device to use with: ls /dev/ttyACM* /dev/ttyUSB*
  • Stop modem manager if it is running: sudo stop modemmanager
  • Type sudo socat - /dev/ttyACM1,crnl or sudo socat - /dev/ttyUSB0 to communicate with the modem.
  • Ensure that the modem is enabled with the command: "AT+CFUN=1"

For example:

    crosh> shell
    chronos@localhost ~ $ sudo stop modemmanager
    chronos@localhost ~ $ ls /dev/ttyACM* /dev/ttyUSB*
    /dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2
    chronos@localhost ~ $ socat - /dev/ttyUSB1
    ATZ
    OK
    AT+CFUN=1
    OK
    ATI
    Manufacturer: Qualcomm Incorporated
    Model: ......
    Revision:....
    ESN: 0x80d...
    +GCAP: +CIS707A, ....

    chronos@localhost ~ $ 

Depending on the modem, you can try different AT commands, e.g. "AT+CGMI", "AT+CGSN", etc.

share|improve this answer
    
No AT command at all is working! This is my problem! Do I need to configure something? Is the commmand line ok? Do I do some big mistake? –  Alex Oct 23 '13 at 15:09
    
@Alex - as I said I do not have any of this hardware so it's difficult to assist you beyond providing information like this. You'll have to debug it. I'd try power cycling the devices in question and see if they're in a hung state, look in the dmesg log for information. Sorry I can't assist you more than this. –  slm Oct 23 '13 at 15:13
    
Can't you just echo "AT+DONTREMEMBERZMODEM" > /dev/modemtty? –  mikeserv Mar 24 at 1:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.