Re: phone as a modem.. Niesha Mahepath

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

 




On Thu, 30 Oct 2008, shanie mahepath wrote:

Um, as a buntunewbie, I am not sure but I don't think it is. What I want to do is have ubuntu regognize my cellphone (z310a) as a modem. In other words when I run sudo wvdial I want to see my phone as a modem (acmo as oppose to dev/tty/ i forget. Is that clearer now? I am thinking this is going to entail a whole new driver. Here is some info. My cellphone is an se z310a and I connect it to my laptop via a blue tooth dongle not a usb cable. So from some research into the wee morning hours it seems that I have to first lsusb to see whether or not its looking at my cell as a modem. And then find the driver for that. Do you think its possible to do it with scanmodem? And if so how?

OK, I see what you're doing now. I've done it with a LG VX8300 phone. It's called 'tethering' and usually done with a USB cable. However, if you have bluetooth and the phone also supports bluetooth, and it advertises what's called a bluetooth modem via SDP, then you can do it without the cable, just with bluetooth. It is a whole different driver - the cdc-acm module is the one that handles that when USB is used. With bluetooth we use rfcomm/serial. I don't know your phone model, but I'm hoping it has a build-in modem in it. These are usually CDMA modems and are full modems, not cheezy Winmodems/softmodems. Once they are registered with the system, they usualy make a device like /dev/ttyACM0 if via USB connection (`procinfo -a ` shows all your available devices, including the modem once it's available). With bluetooth, you'll need to bind an rfcomm device to bluetooth address and channel that the bluetooth modem is advertised on. You find advertised services with the sdptool. I wrote a paper on doing this, but with a USB cable instead because at the time I didn't know how to do it with bluetooth.

The paper I've got here:

https://atr2.ath.cx/~jayjwa/documents/LGVX8300-ACM-linux-dialup.txt

but unforunately, I'm in the middle of moving and so my host will be offline for a bit (even more than as lately when my ISP seems to love dropping my connection randomly), and you'll not be able to reach that a few hours from now as I write this. I did post it to Usenet, and I think maybe the linmodems guys might have copied it some place to an archive. At any rate, likely there's a copy floating around the 'Net some place if you Google the name of the file. All parts are the same except for the bluetooth for USB part, and using your own ISP instead of Verizon. It's a pretty advanced thing to start off with as a new user, but can be done (provided your cell phone has one of those modems built in. )

I recommend bluez versions 3.36, as the new 4.x bluez gave me tons of troubles (so much that I moved back to 3.36) and pairing seems to have troubles as well. Here are the basic steps:

1. Install, setup bluetooth via bluez. I'm on the bluez users list too, so there I posted my config files before, if you need help with that. They should be in the mail list archives (Google bluez-users archive).

2. Set the phone to "discoverable", and scan for it. Note its bluetooth address (bt address). Some phones might be always discoverable, others need a menu option set, then stay like that a certain amount of time. Discoverable means that other bluetooth devices can search and find them.

3. Lauch auth-agent and passkey-agent with the bt address you just found. Use the sdptool command to find what channel the bluetooth modem is on: sdptool browse (bt address). Some distros are missing the passkey-agent/auth-agent tools because the developers labeled them 'examples', but they work very well from command line and don't require GUI and full X11 support w/Gnome just to pair a device! If your install is missing them, you'll either need to go the GUI route with something like Gnome's bluetooth tool or build bluez from source like I did.

4. Bind an rfcomm device to the bt address and channel you found out in the steps above. That's all you need to do for the bluetooth part.

5. Use the 1st rfcomm device now as the device to access the modem by, it will be like /dev/rfcomm0. Make sure Ubuntu actually has these devices in /dev/ and they are read-writable by the user that will be running pppd (usually root, so no matter).

6. Call wvdial or whatever you use to make the ppp connection, with the /dev/rfcomm0 device in place of what you used to use. You'll probably need to set a default route pointing to this connection you just made, if you want to use that as your default connection. The 'ip' tool is best for this, it's usualy at /sbin/ip. You can see all routes there are at the the time with 'ip route show'. To make any one of those the default, ip route replace default via (IP address of the next system you want the traffic to travel to) dev (network device you want to carry the traffic to get it there, probably like "ppp0", obviously without the quotes).

7. When you're done, kill the pppd daemon (pkill pppd) and then unbind the rfcomm device. Since the default route you setup will be now gone, you need a new default one, so set it back to what was your back up link to the outside world. Remember you'll be using cell phone minutes time, so those charges apply.

Here's an example for the bluetooth side of things. All the commands I'm speaking of likely require root privs to use. I'm not showing all the "sudo's" because Ubuntu is the only one that requires that in such a way.

# hcitool scan

Scanning ...
        00:1C:62:19:B1:6A       LG VX8300

# passkey-agent --default 0000 00:1C:62:19:B1:6A &
# auth-agent &

# sdptool browse 00:1C:62:19:B1:6A

Browsing 00:1C:62:19:B1:6A ...
Service Name: OBEX Object Push
Service RecHandle: 0x10000
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 6
  "OBEX" (0x0008)
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100

Service Name: AV Audio Source
Service RecHandle: 0x10001
Service Class ID List:
  "Audio Source" (0x110a)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 25
  "AVDTP" (0x0019)
    uint16: 0x100
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Advanced Audio" (0x110d)
    Version: 0x0100

Service Name: AV Remote Control Target
Service RecHandle: 0x10002
Service Class ID List:
  "AV Remote Target" (0x110c)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 23
  "AVCTP" (0x0017)
    uint16: 0x100
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "AV Remote" (0x110e)
    Version: 0x0100

Service Name: Voice Gateway
Service RecHandle: 0x10003
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 3
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0100

Service Name: Voice Gateway
Service RecHandle: 0x10004
Service Class ID List:
  "Handsfree Audio Gateway" (0x111f)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 4
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Handsfree" (0x111e)
    Version: 0x0101

Service Name: BT DIAG
Service RecHandle: 0x10005
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 16
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Serial Port" (0x1101)

Service Name: Bluetooth Modem
Service RecHandle: 0x10006
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 8
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

  Here we see it's the last entry, and on channel 8.

# rfcomm --help RFCOMM configuration utility ver 3.36
Usage:
        rfcomm [options] <command> <dev>

Options:
        -i [hciX|bdaddr]      Local HCI device or BD Address
        -h, --help            Display help
        -r, --raw             Switch TTY into raw mode
        -A, --auth            Enable authentication
        -E, --encrypt         Enable encryption
        -S, --secure          Secure connection
        -M, --master          Become the master of a piconet
        -f, --config [file]   Specify alternate config file
        -a                    Show all devices (default)

Commands:
        bind     <dev> <bdaddr> [channel]       Bind device
        release  <dev>                          Release device
        show     <dev>                          Show device
        connect  <dev> <bdaddr> [channel]       Connect device
        listen   <dev> [channel [cmd]]          Listen
        watch    <dev> [channel [cmd]]          Watch


  "dev" here means which rfcomm device. It's the first one, 0
   since nothing else is using rfcomm at the moment.

# rfcomm bind 0 00:1C:62:19:B1:6A 8

# rfcomm -a

rfcomm0: 00:1C:62:19:B1:6A channel 8 clean


  We check its status and see it's ready, now we can start something
  to use it. I'll use minicom to test here. The minicom config is
  at minirc.dfl:

# cat /etc/minirc.dfl

 # Machine-generated file - use "minicom -s" to change parameters.
 pr port             /dev/ttyACM0

 Here we see the default is setup for USB use, not bluetooth.
 We need to fix that.

# minicom -s

 'Serial port setup' is the menu, option "A", set to /dev/rfcomm0.
 Hit ESC. Select 'Save setup as dfl'.

 Maybe a bug in minicom, but when I "Exit" and it goes back to
 minicom, I get a bogus error No such device for /dev/rfcomm0.
 This is obviously not correct. Just exit if this happens and
 restart fresh:

Welcome to minicom 2.3

OPTIONS: I18n
Compiled on Jun  1 2008, 00:47:35.
Port /dev/rfcomm0

                 Press CTRL-A Z for help on special keys

AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
OK

 If you see likewise you're good to go. Just exit here and
 plug the /dev/rfcomm0 device into your wvdial config or
 pppd's configs, etc.


 When rfcomm reports while the device is in use, it should
 look like so:

# rfcomm -a
rfcomm0: 00:1C:62:19:B1:6A channel 8 connected [tty-attached]

 Let's exit minicom, test sucess.

 Press CTRL-A, Z for the menu. X to reset and exit.

 At this point, you'd run wvdial/pppd and setup your route, etc.
 When you're done, kill pppd and unbind the rfcomm device.

# rfcomm release 0





[Index of Archives]     [Linux Media Development]     [Asterisk]     [DCCP]     [Netdev]     [X.org]     [Xfree86]     [Fedora Women]     [Linux USB]

  Powered by Linux