Showing posts with label mobile. Show all posts
Showing posts with label mobile. Show all posts

mobile phone as modem

Sunday, October 26, 2008

There are a number of posts around the place on getting gprs or 3g cellphone connections working on linux. I wasn't interested in bluetooth as I have limited batteries and a usb cable. And you don't always know what your locla settings should be.

Here's all I did on Xubuntu Hardy:

  1. Plug the phone into the computer using the usb cable.
  2. In a terminal, type "sudo wvdialconf". (This sets up available baud rates, etc)
  3. In a terminal, type "sudo vi /etc/wvdial.conf".
  4. Edit this file with:
  5. phone = [for my nokia on Vodafone New Zealand, the number is "*99#". I phoned them to find out.]
  6. name = [the login name, if your mobile company requires it. Vfone NZ doesn't, but wvdial needed something here. I used "name"].
  7. password = [as with name. I used "password"].
  8. Save and close the file.
  9. Connect to the internet via your mobile by typing "wvdial" in a terminal window.
  10. When done, press ctrl-c in that window.
So easy and so great!

get connected with infrared device in linux

Wednesday, December 05, 2007

Using Ubuntu (known to work for Feisty and Gutsy), follow the instructions here. The only change to those instructions I needed to make was to set automatic="true' in irda-utils.

Then use the following script:

#! /bin/bash

# phone-connect. Copyright Brad Milne, 2007. Search for infrared phone
# and mount it using obexfs if available.

case "$1" in
start)
echo -n "Starting connection to phone..."

#first restart irda-utils if phone not visible
grep nickname /proc/net/irda/discovery > /dev/null
if [ $? -eq 0 ]; then
/etc/init.d/irda-utils restart > /dev/null
fi
obexfs -i /mnt/phone

if [ $? -eq 0 ]; then
PHONE=$(grep nickname /proc/net/irda/discovery | sed -e 's/nickname: //' | cut -d, -f1)
echo "Connected to $PHONE"
else
echo "Connection failed. Does phone have infrared turned on?"
fi
;;
stop)
# 'stop' I haven't yet been able to implement due to restrictions
# on unmounting the fuse device. For now I use 'sudo umount /mnt/phone'
echo -n "Stopping connection to phone..."
/bin/fusermount -u /mnt/phone/
if [ $? -eq 0 ]; then
echo "Done"
else
echo "Failed. Was it connected?"
fi
;;
status)
ifconfig irda0 | grep irda0 > /dev/null
if [ $? -eq 0 ]; then
echo "Infrared device is active"

grep nickname /proc/net/irda/discovery > /dev/null
if [ $? -eq 0 ]; then
PHONE=$(grep nickname /proc/net/irda/discovery | sed -e 's/nickname: //' | cut -d, -f1)
echo "Currently connected to phone"

if [ $(ls -l /mnt/phone | wc -l) -gt 1 ]; then
echo "Phone files accessible at /mnt/phone"
else
echo "Phone not mounted"
fi
else
echo "Not connected to phone"
fi
else
echo "Infrared device not active. Is infrared device plugged in?"
fi
;;
*)
echo "Usage: phone-connect {start|stop|status}"
;;
esac


Then to make it runnable by any user, do a chmod 4711 as described here, on the script itself, obexfs, irda-utils, and on fusermount (which needs to be readable by all users also).