Friday, 10 October 2008

Success: Two-way phone call with Treo 650 in Linux

Now that I have a VOIP account that can make unmetered calls to mobiles I decided to try having a play with getting two-way phone calls working from Linux on the Treo 650. I turned on the phone part in Palm OS, booted this kernel and reset the power on the gsm module with:
echo 0 > /sys/devices/platform/palmt650-pm-gsm/power_on
echo 1 > /sys/devices/platform/palmt650-pm-gsm/power_on
echo 1 > /sys/devices/platform/palmt650-pm-gsm/wake
I then fired open minicom and opened /dev/ttyS0 at baud 460800 without flow control. I then connected the modem to the network and entered my subsidy unlock pin:
AT+CFUN=1
AT+CPIN="xxxxxxxxx"
Once connected, I called my phone via VOIP and then answered with the ATA command:
RING
RING

ATA
OK
At that point I opened up a few terminal windows and started fiddling with ALSA. I first started playing some white noise so I could heer when I started transmitting:
cat /dev/urandom > /dev/dsp
I discovered you can divert PCM to be transmitted by the phone using:
      Master Mono: Enable, set transmit volume
              PCM: Enable, set PCM volume
PCM Play to Phone: Enable to route PCM signal to the phone module
After some more fiddling I routed the microphone to the phone. The labeling of the Mic controls in the ALSA driver is rather strange but here are the key settings:
      Master Mono: Enable, set transmit volume
Mic Select Source: mic1=handset, mic2=headset
            Mic 2: Selected mic volume
   Mic 1 to phone: Enable/disable handset mic 
   Mic 2 to phone: Enable/disable oheadset mic
   Mic 20dB Boost: Useful in speakerphone mode, you can talk from quite a distance.

Mic 1: [irrelevant?]
Mic select:  [irrelevant?]
After that I managed to get the incoming audio going out the handset earpiece with these settings:
         Master: Enable, earpiece volume
Master Left Inv: Enable
          Phone: Seems you don't need to unmute, but need to set volume.
Phone to Master: Enable
            Aux: Set a high volume (weird stuff happens if low)
    Out3 LR Mux: Master Mix (mislabeled, it's actually out2)
I've made an ALSA state file for working two-way phone audio with the handset.

4 comments:

lone_wolfy said...

Good work Alex, and thanks for sharing it with those of us who like to read blogs like yours. :)

satmandu said...

Very nice. :-)

Ian Dumych said...

Dude you are my hero! I have been going insane trying to find current info on treo linux efforts. I love this phone but Palm OS is so unstable.

tetsujin said...

That's great... I would really love to use Linux on my Treo... I'm so sick of PalmOS's M68K emulation, and jerry-rigged features like NVFS... And I'd just really like to be able to run things like Scheme or Python sometimes without it being a big production...
But my phone's the CDMA version, so I guess I'll have to do some tinkering of my own to get calling to work...