Re: RS232 GSM Modem



On Wed, 2010-05-26 at 16:09 +0200, Tom wrote:
> On Wed, 2010-05-26 at 02:08 -0700, Dan Williams wrote:
> > > root banane:~# stty -F /dev/ttyS1 -a
> > > speed 115200 baud; rows 0; columns 0; line = 0;
> > > intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^A; eol = <undef>;
> > > eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt
> > > = ^R;
> > > werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5;
> > > -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts
> > > ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon
> > > -ixoff
> > > -iuclc -ixany -imaxbel -iutf8
> > > -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
> > > bs0 vt0 ff0
> > > -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop
> > > -echoprt
> > > -echoctl -echoke
> > > 
> > > 
> > > 
> > > I think the modem does not need any special flow control settings. The
> > > baudrate can be set with "AT+IPR=38400" (or another value like 115200). 
> > > But eg. with minicom i can only communicate with the modem when i use
> > > the right baudrate. There is no autodetection or something like this.
> > > 
> > > What does ModemManager? Which Baudrate will be used when ModemManager
> > > tries to detect the modem?
> > 
> > By default MM uses 57600, but this can be changed by a modem plugin,
> > except your device doesn't have a plugin and this sort of thing should
> > probably be solved in a more generic manner.  Unfortunately I don't
> > really know if we can get any hardware IDs off your modem?
> 
> The modem will be detected if i set the baudrate to 57600. Great! I'll
> try out if all works with ModemManager and let you know if there are
> more problems:)
> 
> What do you mean with Hardware IDs? It's possible to use the following
> commands:
> 
> AT+CGMI   <- Request manufacturer identification
> AT+CGMM   <- Request model identification
> AT+CGMR   <- Request revision identification of software status Section

Right, but sending those commands requires that we already know what
baudrate we need, which I'd like to get from hardware IDs before talking
to the device in the first place.

I mean stuff like USB VID/PID, PCI VID/PID, SDIO IDs, etc.  Even
parallel-port devices like printers have IDs.  But for serial ports,
they might not.

It's true that MM doesn't work as well wtih embedded devices like this
at this time, we can certainly work on fixing that by making the
configuration of devices more static for these cases, instead of relying
on probing.

Dan

> 
> 
> > 
> > We could, for generic devices run by platform drivers attempt to do what
> > wvdial sort of does, which is try sending 'AT' at different speeds until
> > it gets an OK.  Then use that speed.  That might solve the problem
> > generically.
> 
> Good idea. but for me it's enough to know that i have to set the
> baudrate to 57600. i'm not very good in C so i can not provide some code
> to do the baudrate-probe. Sorry.
> 
> > If you manually set the modem to 57600 and then run modem-manager, does
> > that work?
> 
> yes. output is:
> 
> ######## BEGIN ############
> 
> ** Message: ModemManager (version 0.3.997) starting...
> ** Message: Loaded plugin Generic
> ** Message: Loaded plugin Huawei
> ** Message: Loaded plugin Option
> ** Message: Loaded plugin Option High-Speed
> ** Message: Loaded plugin ZTE
> ** Message: Loaded plugin Longcheer
> ** Message: Loaded plugin Novatel
> ** Message: Loaded plugin MotoC
> ** Message: Loaded plugin Ericsson MBM
> ** Message: Loaded plugin Gobi
> ** Message: Loaded plugin AnyData
> ** Message: Loaded plugin SimTech
> ** Message: Loaded plugin Nokia
> ** Message: Loaded plugin Sierra
> ** (modem-manager:1833): DEBUG: (tty/ttyS0): port's parent platform
> driver is not whitelisted
> ** (modem-manager:1833): DEBUG: (tty/ttyS2): port's parent platform
> driver is not whitelisted
> ** (modem-manager:1833): DEBUG: (net/usb0): port's parent platform
> driver is not whitelisted
> ** (modem-manager:1833): DEBUG: (net/pan0): could not get port's parent
> device
> ** Message: (ttyS1) opening serial device...
> ** (modem-manager:1833): DEBUG: <1274880815.551890> (ttyS1) device open
> count is 1 (open)
> ** (modem-manager:1833): DEBUG: (ttyS1): probe requested by plugin
> 'Generic'
> ** (modem-manager:1833): DEBUG: <1274880815.654998> (ttyS1): --> 'AT
> +GCAP<CR>'
> ** (modem-manager:1833): DEBUG: <1274880816.534742> (ttyS1): <-- 'AT
> +GCAP<CR><CR><LF>+GCAP: +CGSM,+FCLASS<CR><LF><CR><LF>OK<CR><LF>'
> ** (modem-manager:1833): DEBUG: <1274880816.536649> (ttyS1) device open
> count is 0 (close)
> ** Message: (ttyS1) closing serial device...
> ** Message: (ttyS1) type primary claimed
> by /sys/devices/platform/atmel_usart.1
> ** Message: (ttyS1) opening serial device...
> ** (modem-manager:1833): DEBUG: <1274880816.566765> (ttyS1) device open
> count is 1 (open)
> ** Message: (Generic): GSM modem /sys/devices/platform/atmel_usart.1
> claimed port ttyS1
> ** (modem-manager:1833): DEBUG: Added
> modem /sys/devices/platform/atmel_usart.1
> ** (modem-manager:1833): DEBUG: (tty/ttyS1): outstanding support task
> prevents export of /sys/devices/platform/atmel_usart.1
> ** (modem-manager:1833): DEBUG: <1274880816.570255> (ttyS1): --> 'AT
> +CPIN?<CR>'
> ** (modem-manager:1833): DEBUG: <1274880816.654537> (ttyS1): <-- 'AT
> +CPI'
> ** (modem-manager:1833): DEBUG: <1274880816.664273> (ttyS1): <--
> 'N?<CR>'
> ** (modem-manager:1833): DEBUG: <1274880816.694245> (ttyS1): <--
> '<CR><LF>+CPIN: READY<CR><LF><CR><LF>OK<CR><LF>'
> ** (modem-manager:1833): DEBUG: <1274880816.695440> (ttyS1) device open
> count is 0 (close)
> ** Message: (ttyS1) closing serial device...
> ** (modem-manager:1833): DEBUG: Exported
> modem /sys/devices/platform/atmel_usart.1
> as /org/freedesktop/ModemManager/Modems/0
> ** (modem-manager:1833): DEBUG:
> (/org/freedesktop/ModemManager/Modems/0): data port is ttyS1
> 
> ######### END ############
> 
> 
> Cheers,
> 
> Tom
> 
> > 
> > Dan
> > 
> > > Cheers,
> > > 
> > > Tom
> > > 
> > > 
> > > > 
> > > > Dan
> > > > 
> > > > >  ### BEGIN MINICOM ###
> > > > >  at                                                   
> > > > > OK
> > > > > at&v
> > > > > ACTIVE PROFILE:
> > > > > E1 Q0 V1 X4 &C0 &D2 &S0 \Q0 \V1
> > > > > S0:000 S3:013 S4:010 S5:008 S6:000 S7:060 S8:000 S10:002 S18:000
> > > > > +CBST: 7,0,1
> > > > > +CRLP: 61,61,78,6
> > > > > +CR: 0
> > > > > +FCLASS: 0
> > > > > +ICF: 3
> > > > > +IFC: 0,0
> > > > > +ILRR:
> > > > > 0                                                                        
> > > > > +IPR:
> > > > > 115200                                                                    
> > > > > +CMEE:
> > > > > 0                                                                        
> > > > > ^SCKS:
> > > > > 0,1                                                                      
> > > > > ^SSET:
> > > > > 0                                                                        
> > > > >                                                                                 
> > > > > OK                          
> > > > > 
> > > > >  ### END MINICOM ###
> > > > > 
> > > > > Hope this helps,
> > > > > 
> > > > > Cheers
> > > > > 
> > > > > Tom
> > > > > 
> > > > > 
> > > > >         
> > > > >         
> > > > >         
> > > > >         > Cheers,
> > > > >         >
> > > > >         > Tom
> > > > >         >
> > > > >         >
> > > > >         >         Dan
> > > > >         >
> > > > >         >
> > > > >         >         > The information about the device (  /dev/ttyS1 ):
> > > > >         >         >
> > > > >         >         > # udevadm info --query=all -n /dev/ttyS1
> > > > >         >         > P: /devices/platform/atmel_usart.1/tty/ttyS1
> > > > >         >         > N: ttyS1
> > > > >         >         > S: char/4:65
> > > > >         >         > E: UDEV_LOG=3
> > > > >         >         > E:
> > > > >         DEVPATH=/devices/platform/atmel_usart.1/tty/ttyS1
> > > > >         >         > E: MAJOR=4
> > > > >         >         > E: MINOR=65
> > > > >         >         > E: DEVNAME=/dev/ttyS1
> > > > >         >         > E: SUBSYSTEM=tty
> > > > >         >         > E: DEVLINKS=/dev/char/4:65
> > > > >         >         >
> > > > >         >         > # udevadm info --query=all -n /dev/ttyS1
> > > > >         --attribute-walk
> > > > >         >         > ...
> > > > >         >         > looking at device
> > > > >         >         '/devices/platform/atmel_usart.1/tty/ttyS1':
> > > > >         >         >     KERNEL=="ttyS1"
> > > > >         >         >     SUBSYSTEM=="tty"
> > > > >         >         >     DRIVER==""
> > > > >         >         >
> > > > >         >         >   looking at parent device
> > > > >         >         '/devices/platform/atmel_usart.1':
> > > > >         >         >     KERNELS=="atmel_usart.1"
> > > > >         >         >     SUBSYSTEMS=="platform"
> > > > >         >         >     DRIVERS=="atmel_usart"
> > > > >         >         >     ATTRS{modalias}=="platform:atmel_usart"
> > > > >         >         >
> > > > >         >         >   looking at parent device '/devices/platform':
> > > > >         >         >     KERNELS=="platform"
> > > > >         >         >     SUBSYSTEMS==""
> > > > >         >         >     DRIVERS==""
> > > > >         >         >
> > > > >         >         >
> > > > >         >         > How can i use this port with ModemManager? The
> > > > >         modem is
> > > > >         >         connected and
> > > > >         >         > AT-Commands works.
> > > > >         >         >
> > > > >         >         >         There are a number of requirements of the
> > > > >         port
> > > > >         >         though; it
> > > > >         >         >         verifies that the kernel has assigned a
> > > > >         driver name
> > > > >         >         to the
> > > > >         >         >         port or one
> > > > >         >         >         of the port's parents, and it attempts to
> > > > >         grab the
> > > > >         >         port's
> > > > >         >         >         physical
> > > > >         >         >         device.  Given that it's USB, it *should*
> > > > >         work.  But
> > > > >         >         if it
> > > > >         >         >         doesn't, and
> > > > >         >         >         you have a chance to grab the ModemManager
> > > > >         source
> > > > >         >         [1], there's
> > > > >         >         >         a tool
> > > > >         >         >         called 'lsudev' in the test/ directory
> > > > >         that can give
> > > > >         >         us an
> > > > >         >         >         idea of the
> > > > >         >         >         udev-provided information of the device.
> > > > >         >         >
> > > > >         >         > i guess 'lsudev' does the same as my 2 commands
> > > > >         with
> > > > >         >         'udevadm', right?
> > > > >         >         > or does 'lsudev' something more special?
> > > > >         >         >
> > > > >         >         >
> > > > >         >         >         > 2) How does the connection-config looks
> > > > >         like?
> > > > >         >         >
> > > > >         >         >
> > > > >         >         >         ModemManager is just a tool to control the
> > > > >         modem, it
> > > > >         >         doesn't
> > > > >         >         >         store any
> > > > >         >         >         configuration about it.  The configuration
> > > > >         is
> > > > >         >         provided by a
> > > > >         >         >         program that
> > > > >         >         >         tells ModemManager what to do.  There are
> > > > >         a few ways
> > > > >         >         to do
> > > > >         >         >         that;
> > > > >         >         >         NetworkManager provides a general modem
> > > > >         control
> > > > >         >         solution, but
> > > > >         >         >         you can
> > > > >         >         >         also write your own app that uses D-Bus to
> > > > >         tell
> > > > >         >         ModemManager
> > > > >         >         >         what to do
> > > > >         >         >         with the modem.  See test/mm-test.py for a
> > > > >         short
> > > > >         >         example of
> > > > >         >         >         how to use
> > > > >         >         >         python and D-Bus to make MM connect the
> > > > >         modem and
> > > > >         >         get
> > > > >         >         >         information out of
> > > > >         >         >         it.
> > > > >         >         >
> > > > >         >         > ah. that's great. i need to control the modem over
> > > > >         a
> > > > >         >         web-interface so
> > > > >         >         > no nm-applet available.
> > > > >         >         >
> > > > >         >         >
> > > > >         >         > Cheers,
> > > > >         >         >
> > > > >         >         > Tom
> > > > >         >         >
> > > > >         >
> > > > >         >
> > > > >         >
> > > > >         >
> > > > >         
> > > > >         
> > > > >         
> > > > > 
> > > > 
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]