Join Today
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1

    Default Linux hotplug setup for usblan

    I've set up everything on my Mandriva box so that when I plug in my A780, the whole combo goes off to make telnet possible, and automatically mount the phone's samba shares.

    Just in case anyone's interested, here are the files required :

    /etc/hosts
    Code:
    --(other stuff)--
    192.168.1.2             a780 A780 phone
    /etc/hotplug/usb/acm
    Code:
    #!/bin/bash
    
    cd /etc/hotplug
    . hotplug.functions
    
    # env >  /tmp/usb-phone-env.log
    if [ $PRODUCT = 22b8/3802/0 -a $ACTION = add ] ; then
        if ! ps -e | grep sync-phone.sh; then
    	/usr/local/bin/sync-phone.sh < /dev/null &> /tmp/sync-phone.log &
        fi
    fi
    /usr/local/bin/sync-phone.sh
    Code:
    #! /bin/sh
    
    echo "$0 is starting..."
    
    # Try to prevent multiple instances of this script...
    
    # 1. by using a lockfile
    LOCKFILE=/var/lock/sync-phone.lock
    [ -f $LOCKFILE ] && exit 0
    trap "rm -f $LOCKFILE" EXIT
    touch $LOCKFILE
    
    # 2. by killing newborn duplicates
    PCOUNT=`ps -e -C $(basename "$0") | wc -l`
    if [ $PCOUNT -gt 1 ]; then 
        for PID in `ps -C $(basename "$0") -o "%p" | sed -e "1,+1d"`
          do 
          echo "killing newborn duplicate script $PID"
          kill $PID
          done      
    fi
    
    # Wait for device to appear
    DEVICE=/dev/usb/acm/0
    i=1
    while [ $i -lt 10 ] ; do
        if [ -e $DEVICE ] ; then
            i=10
        else
    	echo "Waiting for device $DEVICE to appear..."
            sleep 1
            i=$(($i + 1))
        fi
    done
    
    if [ ! -e $DEVICE ] ; then
        exit 1
    fi
    
    echo "device $DEVICE found"
    
    if fuser -v /dev/dsp; then play /usr/share/sounds/pop.wav; fi
    # 1. minicom -> AT+MODE=99, killall minicom
    #/usr/bin/runscript /usr/local/share/A780/minicom.script
    echo "Starting minicom for phone initialization"
    /usr/bin/screen -d -m /usr/local/bin/minicom-usblan.sh
    sleep 6
    echo "Killing minicom"
    killall -9 minicom
    # 2. insmod usblan.o vendor_id=0x22b8 product_id=0x600c
    echo "Installing usblan kernel module"
    /sbin/insmod /usr/local/share/A780/usblan/usblan.o vendor_id=0x22b8 product_id=0x600c
    # 3. ifconfig usb0 192.168.1.1
    # useless thanks to /etc/sysconfig/network-scripts/ifcfg-usb0
    #/sbin/ifconfig usb0 172.16.0.1
    # 4. telnet 192.168.1.2 as root AND DO STUFF
    # 5. samba shares
    echo "Mounting the phone's samba shares"
    # try to umount everything, just to make sure
    while sleep 1 && umount -lf /mnt/phone/*; do echo "umounting"; done
    /bin/mount -o guest,gid=mnt,rw,users,dmask=770 //phone/home /mnt/phone/home
    /bin/mount -o guest,gid=mnt,rw,users,dmask=770 //phone/system /mnt/phone/system
    
    if fuser -v /dev/dsp; then play /usr/share/sounds/pop.wav; fi
    
    echo "Starting the umounter watch script"
    nohup /usr/local/bin/umount-phone.sh &

    /usr/local/bin/umount-phone.sh
    Code:
    #!/bin/sh
    
    if ! mount | grep /mnt/phone; 
        then 
        echo "nothing to do"
        exit
    fi
    
    while ls /mnt/phone/home >/dev/null
    do
    #  echo "waiting for phone to be unplugged"
      sleep 2
    done
    
    while sleep 1 && umount -lf /mnt/phone/*; do echo "umounting"; done
    if fuser -v /dev/dsp; then play /usr/share/sounds/pop.wav; fi

    /usr/local/bin/minicom-usblan.sh
    Code:
    #!/bin/sh
    /usr/bin/minicom usblan
    /etc/minirc.usblan
    Code:
    # Machine-generated file - use "minicom -s" to change parameters.
    pr port             /dev/ttyACM0
    pu baudrate         4800
    pu minit            ~^M~AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0^MAT+MODE=99^M
    (notice the AT+MODE=99 at the end of the init string)

    /etc/sysconfig/network-scripts/ifcfg-usb0
    Code:
    DEVICE=usb0
    BOOTPROTO=static
    IPADDR=192.168.1.10
    NETMASK=255.255.255.0
    NETWORK=192.168.1.0
    BROADCAST=192.168.1.255
    ONBOOT=no
    Here you are, this is my basic setup. I hope that'll help.

    As soon as possible, I'll add automatic backup / synchronization to this stuff. But first I have to locate where on the phone are stored the SMS, contact and agenda... If you have any suggestions, let me know.

  2. #2

    Default Re: Linux hotplug setup for usblan

    Cool. I'll be trying it sometime before the weekend (so much to do, and so little time to do it...

    Meanwhile, the biggest question (among many smaller ones that I will postpone until I try this) is: where do you get the file you called /usr/local/share/A780/usblan/usblan.o ?

    Thanks again!

  3. #3
    Join Date
    May 2005
    Location
    europe
    Posts
    170

    Default Re: Linux hotplug setup for usblan

    Very good, thanks. I always hate scripting automatizations for hotplug/acpi by myself
    sitaramc, 2.6.12 kernel has working usbnet.o included and use it instead of usblan.o. just "modprobe usbnet"

  4. #4

    Default Re: Linux hotplug setup for usblan

    Quote Originally Posted by sitaramc
    where do you get the file you called /usr/local/share/A780/usblan/usblan.o ?
    Usblan module for kernel 2.4 found on Belcarra's website, which I compiled without any troubles.

  5. #5

    Default Re: Linux hotplug setup for usblan

    Quote Originally Posted by evaldas
    2.6.12 kernel has working usbnet.o included and use it instead of usblan.o. just "modprobe usbnet"
    Is that what you personally use? Cause I'd be glad to revert to a shiny 2.6 kernel if that usbnet module really works.

  6. #6
    Join Date
    May 2005
    Location
    europe
    Posts
    170

    Default Re: Linux hotplug setup for usblan

    Quote Originally Posted by irinoxx
    Quote Originally Posted by evaldas
    2.6.12 kernel has working usbnet.o included and use it instead of usblan.o. just "modprobe usbnet"
    Is that what you personally use? Cause I'd be glad to revert to a shiny 2.6 kernel if that usbnet module really works.
    It only works with 2.6.12-rc* or later kernels (including final 2.6.12).

  7. #7
    Join Date
    May 2005
    Location
    Germany, Hannover
    Posts
    289

    Default Re: Linux hotplug setup for usblan

    Quote Originally Posted by evaldas
    It only works with 2.6.12-rc* or later kernels (including final 2.6.12).
    No thats wrong, with a little bit hand work you can get it running with other kernels too!

    I have patched my 2.6.11-gentoo-r8 kernel and it works. You find patch at SourceForge.

  8. #8

    Default Re: Linux hotplug setup for usblan

    I've just edited the first post of this thread to fix a few issues :

    For some reason the hotplugging script got called multiple times in a row when I plugged my phone. I've made sure only one instance of the script can run at the same time.
    I've added a monitoring script to automatically umount the samba shares when the phone is unplugged.
    The scripts no longer try to play the pop sound if /dev/dsp is already in use (this bug froze the scripts)

    (The modified files are sync_phone.sh, umount_phone.sh and the hotplug acm script)

  9. #9
    Join Date
    Jul 2005
    Location
    Argentina
    Posts
    41

    Default Re: Linux hotplug setup for usblan

    Quote Originally Posted by irinoxx
    Quote Originally Posted by evaldas
    2.6.12 kernel has working usbnet.o included and use it instead of usblan.o. just "modprobe usbnet"
    Is that what you personally use? Cause I'd be glad to revert to a shiny 2.6 kernel if that usbnet module really works.
    Yes! it works!

    You need to patch the drivers/usb/net/usbnet.c file with:
    @@ -4071,6 +4071,9 @@
    USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader
    .driver_info = (unsigned long) &blob_info,
    }, {
    + USB_DEVICE (0x22b8, 0x600c), // USBNET Motorola E680
    + .driver_info = (unsigned long) &linuxdev_info,
    +}, {
    + USB_DEVICE (0x22b8, 0x3802), // USBNET Motorola E680i
    + .driver_info = (unsigned long) &linuxdev_info,
    +}, {

    [for kernel 2.6.12, vanilla]

    I have successfully telnet to e680 with that patch, and now I am trying to make it work with e680i. with 680i, The patch works, and I can see the the usb0 interfase when I plug the phone. The problem I am having is:

    when I send
    AT+MODE=99
    to the phone (via minicom, for example)
    a get:
    ERROR
    Any suggenstion?

    Edited: found the solution:
    Quote Originally Posted by maxx_730
    the AT+MODE=99 thing was only for E680, not for E680i, for E680i you have to install linloader and make a script that says:
    #!/bin/bash
    echo MotNet > /proc/usbd-switch

  10. #10

    Default Re: Linux hotplug setup for usblan

    did u find out where the SMS messages are stored on the system ?

    thanks
    -maq


 
+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. USBLAN setup Rokr E6
    By debankur in forum E6 General Chat
    Replies: 9
    Last Post: 01-05-2010, 09:07 PM
  2. Help regarding GPRS Setup using E6 on Puppy Linux
    By cooltaurus89 in forum E6 General Chat
    Replies: 4
    Last Post: 05-27-2009, 06:29 AM
  3. help ...i want to setup my e680/i modem on linux.
    By day3order in forum E680i General Chat
    Replies: 0
    Last Post: 09-20-2006, 06:57 AM
  4. Setup a Linux Developement Enviroment
    By skorianez in forum Development
    Replies: 0
    Last Post: 09-09-2006, 07:15 PM
  5. USBLAN driver for Linux ?
    By mack in forum A780 General Chat
    Replies: 8
    Last Post: 08-17-2005, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1