Sierra Wireless in X61, ttyUSB0 not detected

2010-05-24
2013-04-15
  • Sebastian Koch
    Sebastian Koch
    2010-05-24

    umtsmon doesn't detect the device ttyUSB0 in my lenovo X61 with 1199:6813 Sierra Wireless, Inc.
    Even if I force umtsmon by using -serial ttyUSB0,ttyUSB2 umtsmon only uses ttyUSB2 for AT-commands and pppd.
    This leads to the problem that umtsmon cannot show the field strength while the pppd is running.

    The log file:
    umtsmon version 0.9.72 .
    ##P1 t=322: setVerbosity: '4'
    ##P2 t=322: set verbosity level to 4
    ##P2 t=322: set PPP verbosity level to 1
    ##P2 t=322: Settings will be saved in : '/home/seb/.umtsmon'
    ##P4 t=322: loadTranslator('qt', 'de_DE@EURO')
    ##P4 t=322:  .. found in '/usr/lib/qt3/translations'
    ##P4 t=322: loadTranslator('umtsmon', 'de_DE@EURO')
    ##P4 t=322:  .. found in 'i18n'
    ##P3 t=322: Will use specified (de_DE@EURO) locale for QT-internal strings
    ##P3 t=322: Will use specified (de_DE@EURO) locale for umtsmon strings
    ##P2 t=322: Warning with Memory Name: WelcomeMsg, Message: Willkommen bei UMTSmon!
    ##P3 t=322:   Message not shown due to user preference
    ##P3 t=323: ObserverManager COPY constructor
    ##P4 t=323: DummyConnection::DummyConnection(void)
    ##P3 t=323: Device creation for type 0x00000001 requested
    ##P2 t=323: Profile::Profile('')
    ##P2 t=323:   finally created profile for 'alice'
    ##P2 t=323: UIState::newConnectionState(0) callback called
    ##P2 t=326: ***UIState::update(void), state=0
    ##P2 t=326:

    UIState::setState(0 -> 1)
    ##P3 t=326: TheDeviceManagerSingleton::setupDevice(void)
    ##P3 t=326: TheDeviceManagerSingleton::readFromConfigFile()
    ##P4 t=326: read PPP port from config: '/dev/ttyUSB0'.
    ##P4 t=326: read AT port from config: '/dev/ttyUSB2'.
    ##P4 t=326: read device type from config: 0x51322402
    ##P3 t=326: Complete config read from file - good :-)
    ##P3 t=326: Start iterating through all AutoDetectors

    ##P4 t=326: Kernel: 'Linux version 2.6.27.45-0.1-pae (geeko@buildhost) (gcc version 4.3.2  (SUSE Linux) ) #1 SMP 2010-02-22 16:49:47 +0100'
    ##P3 t=326: AutoDetectBase::go() for 'Device creation from supplied parameters'
    ##P3 t=326:  AutoDetectBase::createDevice() for CardType 0x51322402
    ##P3 t=326: Device creation for type 0x51322402 requested
    ##P2 t=326: Profile::Profile('')
    ##P2 t=326:   finally created profile for 'alice'
    ##P3 t=326: Device: probing port '/dev/ttyUSB0' for AT commands
    ##P3 t=326: TempSerialPort::TempSerialPort()
    ##P3 t=326: Serial::openDev('/dev/ttyUSB0') as FD 7 - Serial instance 0xbff0fb0c
    ##P4 t=326: Query sends the following mesage: 'AT'
    ##P2 t=326: Device port '/dev/ttyUSB0': no response to "AT", return code 5
    ##P3 t=326: Device: probing port '/dev/ttyUSB0' failed
    ##P3 t=326: TempSerialPort::~TempSerialPort()
    ##P3 t=326: SerialPort::closeDev() for FD 7
    ##P3 t=326: Device: probing port '/dev/ttyUSB2' for AT commands
    ##P3 t=326: TempSerialPort::TempSerialPort()
    ##P3 t=326: Serial::openDev('/dev/ttyUSB2') as FD 7 - Serial instance 0xbff0fb0c
    ##P4 t=326: Query sends the following mesage: 'AT'
    ##P4 t=326: answer 1:'OK'
    ##P3 t=326: Got Query::OK from port
    ##P3 t=326: Device: probing port '/dev/ttyUSB2' successful
    ##P3 t=326: TempSerialPort::~TempSerialPort()
    ##P3 t=326: SerialPort::closeDev() for FD 7
    ##P3 t=326: set AT  serial to '/dev/ttyUSB2'
    ##P3 t=326: set PPP serial to '/dev/ttyUSB2'
    ##P3 t=326: Serial::openDev('/dev/ttyUSB2') as FD 7 - Serial instance 0x818b540
    ##P2 t=326: GOOD: 'Device created successfully'
    ##P2 t=326: Using existing hardware config, not written to disk
    ##P3 t=326: Everything done - device created

    regards,
    Sebastian

     
  • Sebastian Koch
    Sebastian Koch
    2010-05-24

    The problem is based on the inability of the sierra card to strip leading carriage returns in front of AT-commands.

    liza:umtsmon 4> cat /dev/ttyUSB0 &
    liza:umtsmon 4> echo -en "\rAT\r"  >> /dev/ttyUSB0
    liza:umtsmon 4> echo -en "AT\r"  >> /dev/ttyUSB0
    liza:umtsmon 4> AT
    OK

    liza:umtsmon 4>
    The "\rAT\r" is obviously ignored by the sierra wireless device. The "AT\r" is accepted.

    Even if the problem is raised by a bug in the sierra wireless I would suggest to strip
    the leading '\r'. Here is my patch:

    Index: src/model/Query.cpp

    RCS file: /cvsroot/umtsmon/umtsmon/src/model/Query.cpp,v
    retrieving revision 1.14
    diff -u -r1.14 Query.cpp
    -- src/model/Query.cpp 9 May 2009 03:56:24 -0000       1.14
    +++ src/model/Query.cpp 24 May 2010 11:51:52 -0000
    @@ -146,8 +146,15 @@
            if (isFirstRun == true)
            {
                    DEBUG4("Query sends the following mesage: '%s'\n", theQueryString.ascii());
    -               if (theSerialPortPtr->writeDev("\r"+theQueryString+"\r")
    -                       == false)
    +#if 1
    +               // seb, 2010/05/23
    +               // this fails on my Sierra Wireless Board (1199:6813 Sierra Wireless, Inc.)
    +               // because it cannot handle an empty line (terminated by an \r) in front of
    +               // an AT-command.
    +               if (theSerialPortPtr->writeDev("\r"+theQueryString+"\r") == false)
    +#else
    +               if (theSerialPortPtr->writeDev(theQueryString+"\r") == false)
    +#endif

    regards,
    Sebastian

     
  • Klaas van Gend
    Klaas van Gend
    2010-05-31

    Thanks for the analysis and the (ugly) patch.
    However, umtsmon is in maintenance mode. No further development is done.
    I will not fixup the patch and merge it into umtsmon.

     
  • Sebastian Koch
    Sebastian Koch
    2010-06-04

    For my information only. Why do you think the patch is ugly?

     
  • Klaas van Gend
    Klaas van Gend
    2010-06-04

    Your patch is ugly because:

    1) Because the patch only works for your case. It is not generalized enough.
    I'm pretty sure that your patch will break many other users.

    2) conditional compilation (#if 1) are in most open source projects only used to
    switch between functionality at compile time - depending on configuration options from the configure script.

    Let me re-iterate: I think your patch will work for your case.
    You did a good piece of research and the conclusion seems valid.

    To make your patch acceptable, we would need a mechanism to generalise this behavior, though.
    This should be configurable - i.e. part of the config file.
    I'd imagine a new option LeadingCarriageReturns.
    If not present in config file, use "\r".
    If present and yes, use "\r".
    If present and no, use "".

    There are more options in umtsmon that can only be accessed through the config file, like extra AT commands during connection setup and a non-standard CID.