Next Previous Contents

3. Connectivity

3.1 Host environment

I ran all the software discussed in this article on the following platform:

3.2 USB connectivity

The first thing I tried to do was get the phone connected to the computer over USB. Since the USB cable comes along with the package, simple connectivity was straight-forward. Just plug the phone in and it's sort of recognised by the USB sub-system.

lsusb gives the following output once the phone is plugged in:

================================================================
Bus 001 Device 013: ID 22b8:3802 Motorola PCS 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        16
  idVendor           0x22b8 Motorola PCS
  idProduct          0x3802 
  bcdDevice            0.01
  iManufacturer           1 Motorola Inc.
  iProduct                2 Motorola Phone
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           67
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          3
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands
      iInterface              4 Comm Intf
  unknown descriptor type: 05 24 00 01 01
  unknown descriptor type: 05 24 01 03 01
  unknown descriptor type: 05 24 06 00 01
  unknown descriptor type: 04 24 02 02
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
        wMaxPacketSize          8
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 Data
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              5 Data Intf
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize         64
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize         64
        bInterval               0
  Language IDs: (length=4)
     0409 English(US)

Bus 001 Device 012: ID 058f:9254 Alcor Micro, Inc. Hub
  Language IDs: none (invalid length string descriptor bf; len=0)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x058f Alcor Micro, Inc.
  idProduct          0x9254 Hub
  bcdDevice            3.12
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
        wMaxPacketSize          1
        bInterval             255
  Language IDs: none (invalid length string descriptor bf; len=0)

Bus 001 Device 001: ID 0000:0000  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0000 
  idProduct          0x0000 
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.7 uhci_hcd
  iProduct                2 Intel Corp. 82371AB/EB/MB PIIX4 USB
  iSerial                 1 0000:00:07.2
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
        wMaxPacketSize          2
        bInterval             255
  Language IDs: (length=4)
     0409 English(US)
================================================================

while cat /proc/bus/usb/devices results in:

================================================================
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc= 11/900 us ( 1%), #Int=  1, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.7 uhci_hcd
S:  Product=Intel Corp. 82371AB/EB/MB PIIX4 USB
S:  SerialNumber=0000:00:07.2
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 12 Spd=12  MxCh= 4
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=058f ProdID=9254 Rev= 3.12
S:  Manufacturer=ALCOR
S:  Product=Generic USB Hub
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=255ms

T:  Bus=01 Lev=02 Prnt=12 Port=01 Cnt=01 Dev#= 13 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=16 #Cfgs=  1
P:  Vendor=22b8 ProdID=3802 Rev= 0.01
S:  Manufacturer=Motorola Inc.
S:  Product=Motorola Phone
C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm
E:  Ad=85(I) Atr=03(Int.) MxPS=   8 Ivl=10ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
================================================================

You can use the USB Abstract Control Model (ACM) to make the A760 act like a serial device. modprobe cdc-acm results in the following log entries:

================================================================
cdc_acm 1-1.2:1.0: usb_probe_interface
cdc_acm 1-1.2:1.0: usb_probe_interface - got id
cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
usbcore: registered new driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.23:USB Abstract Control Model driver for USB modems and ISDN adapters
================================================================

I don't really know where to go after this. cu(1) fails on trying to connect to /dev/input/ttyACM0 with a ``Line in use'' message. Any further inputs on USB connectivity are welcome.

3.3 IrDA connectivity

The MA620 IrDA USB dongle

Since I didn't have any IR devices in my computer, I had to ask Amit Kalra, my friendly neighbourhood hardware guru and supplier to provide me with an IR port. We decided on a USB-IR dongle, and off went his employee to Nehru Place to pick one up. I ended up with no-name dongle, made in China and ``compatible with W*nd*ws 98, ME, XP and 2000''.

The IrDA dongle has the following specifications as per its cover:

Some investigation showed that the dongle has USB device ID df7/620/10. Further searching on Google revealed that this is the (in)famous MA620 dongle, based on the MA600 IR chipset and the PL2303 USB-serial converter.

Chalo, at least one knows what it is, half the battle over. Now to get the beast to actually work with Linux...

MA620 and Linux, or There and Back Again

Thanks to the the irda-users mailing list and frantic searching on Google, I managed to get the dongle working with Linux at 9600bps (bits per second) within a day or so. The various modules that you need to accomplish this are:

From what I understand, the -sir modules are the USB versions of the corresponding serial IR modules. My original script to enable the dongle was:

================================================================
#!/bin/sh
#
# Minimal stuff required to get the MA620 USB IRDA dongle recognised by
# the kernel.  Version 1 -- works with unpatched kernel, but only at
# 9600bps.

modprobe uhci_hcd
modprobe pl2303
modprobe irda
echo 9600 > /proc/sys/net/irda/max_baud_rate
modprobe irtty-sir
modprobe ma600-sir
modprobe ircomm-tty
irattach /dev/usb/ttyUSB0 -d ma600 -s

exit 0
================================================================

As you would guess, the echo 9600 line limits the rate of the IrDA dongle to 9600bps. This is because the MA620 driver is still being worked on and there's a small bug that causes problems at higher speeds.

On submitting this problem to the irda-users mailing list, Martin Diehl suggested a small change in the kernel. I quote him:

Simply try editing the file linux/drivers/net/irda/ma600-sir.c. In line 197 (2.6.7-vanilla) change the "#if 1" to read "#if 0" and rebuild your module. By chance this will help you out because the speed chance was likely working, just the verification failed.

Being part of the ``Top 10 Clueless About Kernel List'', I blindly followed his suggestion and rebuilt the kernel, and lo and behold, suddenly I could use the dongle at higher speeds.

With Martin's change in place I've so far used the USB port at up to 115200bps without problems. The speed still kind of sucks when transferring MP3s to the phone (more about that later), but baby, let me tell you, it's definitely an improvement over 9600bps!

Here's the new script for enabling the MA620 USB IrDA dongle with a patched kernel 2.6.7:

================================================================
#!/bin/sh
#
# Minimal stuff required to get the MA620 USB IRDA dongle recognised by
# the kernel.  Version 2 -- works only with kernel patched with Martin
# Diehl's #if 0, at up to 115200bps.

modprobe uhci_hcd
modprobe pl2303
modprobe irda
modprobe irtty-sir
modprobe ma600-sir
modprobe ircomm-tty
irattach /dev/usb/ttyUSB0 -d ma600 -s

exit 0
================================================================

All that has happened is that the line limiting the IR rate to 9600bps before loading the remaining drivers has vanished. L33t, huh? :)

After you start IrDA (and assuming everything works OK), you should see something like the following when you put the phone (with cover open) in front of the dongle and run irdadump(8):

================================================================
14:19:49.808390 xid:rsp 3f8d7c1b > e3afec86 S=6 s=3 mail hint=0400 [ Computer ] (20)
14:19:50.205921 xid:cmd ffffffff < e3afec86 S=6 s=* A760 hint=c124 [ PnP LAN Access IrCOMM IrOBEX ] (21)
================================================================

The files in /proc/net/irda have the following contents, which I cannot decipher but presumably someone can, otherwise they wouldn't be there:

================================================================
*** /proc/net/irda/discovery:
IrLMP: Discovery log:

nickname: A760, hint: 0xc124, saddr: 0x3f8d7c1b, daddr: 0xe9877945

*** /proc/net/irda/ircomm:

*** /proc/net/irda/irias:
LM-IAS Objects:
name: Device, id=0
 - Attribute name: "IrLMPSupport", value[IAS_OCT_SEQ]: octet sequence (3 bytes)

 - Attribute name: "DeviceName", value[IAS_STRING]: "mail"


*** /proc/net/irda/irlap:
irlap0 state: LAP_NDM
  device name: irda0, hardware name: ttyUSB0
  caddr: 0x20, saddr: 0x3f8d7c1b, daddr: 0x000000
  win size: 0, win: 0, line capacity: 0, bytes left: 0
  tx queue len: 0 win queue len: 0 rbusy: FALSE mbusy: FALSE
  retrans: 0 vs: 0 vr: 0 va: 0
  qos   bps     maxtt   dsize   winsize addbofs mintt   ldisc   comp
  tx    9600    0       64      1       12      0       0
  rx    9600    0       64      1       12      0       0

*** /proc/net/irda/irlmp:
Unconnected LSAPs:
lsap state: LSAP_DISCONNECTED, slsap_sel: 0x0, dlsap_sel: 0xff, (IrIAS srv)

Registered Link Layers:
lap state: LAP_STANDBY, saddr: 0x3f8d7c1b, daddr: 0xffffffff, num lsaps: 0

  Connected LSAPs:

*** /proc/net/irda/irttp:

================================================================


Next Previous Contents