Results 1 to 6 of 6

Thread: Fix: BT4 r2 iPhone 4 Native USB Tethering

Hybrid View

  1. #1
    Just burned his ISO
    Join Date
    Sep 2010
    Posts
    15

    Lightbulb Fix: BT4 r2 iPhone 4 Native USB Tethering

    The Problem: The iPhone USB Ethernet Driver (ipheth) kernel module
    has been accepted upstream as of Apr 21 2010 for kernel 2.6.34; however, the ipheth kernel module is missing support for the iPhone 4.

    "This is a Linux Kernel driver that adds support for iPhone tethering through USB cables. Unlike other solutions out there, you don't need to jailbreak your phone or install third-party proxy applications."

    There has been a patch released in Kernel 2.6.36 to include support for iPhone 4; however, in Backtrack 4 r2 we're currently only to kernel 2.6.35.

    Once BackTrack is updated to use Kernel 2.6.36 or later the ipheth module included with the kernel should natively support the latest iPhones. See the below links for an overview of the issue:

    (https://bbs.archlinux.org/viewtopic.php?id=107388)
    (LKML: David Miller: Re: [PATCH] drivers/net/usb: Add new driver ipheth)
    (git.kernel.org - linux/kernel/git/torvalds/linux-2.6.git/commitdiff)

    The Fix: To enable native USB tethering for the iPhone 4 in BackTrack 4 r2 using an updated ipheth driver and pairing utility.

    Regardless of whether or not you have an iPhone 4 or an older version (2G, 3G, 3GS) you'll also still need a user-space pairing program for the driver to work.

    "The pairing program is necessary in order to do a handshake and pair the device with the computer, otherwise it won't respond to kernel driver requests and thus won't work."

    Currently there are two main options for pairing:

    1. The ipheth-pair utility packaged with the ipheth-driver:
    (Diego Giagio :: Personal Website - iPhoneEthernetDriver)

    2. The newly added idevicepair utitlity packaged with libimobiledevice (aka libiphone).
    (libimobiledevice - Teaching Penguins to talk to fruits)
    (ipheth - Page 4 - Linux Archive)

    In this tutorial we'll be using the ipheth-pair utility as it's already included in the package with the ipheth-driver. Keep in mind though, that the idevicepair utility will be the one supported in future releases; however, it currently has very limited documentation and does not include a udev rule to automatically pair the iPhone upon connection. We could easily create our own udev rule until an official one is released; however, I still had some issues getting idevicepair to actually give me an internet connection. More on udev in Part 3 below.

    Overview: This fix/tutorial will be largely based on the following tutorials with customizations specific for BackTrack 4 r2. Look these pages over first:

    (https://wiki.archlinux.org/index.php...Native_Support)
    (Abort, Retry, Hack? » Blog Archive » iPhone syncing on Linux, part 2)

    Warning: "If you are a new or inexperienced user, or you are not used to compiling things from source, editing configuration files, and doing some basic troubleshooting, stop here. This isn’t ready for you. In the not too distant future, distros will package this, it will be delivered with your usual dose of healthy and working open source software, and it will all work automagically as soon as you plug in your device."

    Background: View the following links for descriptions and comprehensive diagrams of the software architecture/stack that we will be compiling.

    (usbmuxd: iPhone/iPod Touch Linux Syncing Support | FSMdotCOM)
    (libiphone)
    (http://www.libimobiledevice.org/am-stack-fig-4.png)

    As there is a 10,000 character limit per post, I'll be posting the tutorial in three separate parts:
    • Part 1, Compiling package dependencies and Install
    • Part 2, Test, Debug, and Manual Pairing
    • Part 3, Automatic Pairing using udev rules

  2. #2
    Just burned his ISO
    Join Date
    Sep 2010
    Posts
    15

    Default Re: Fix: BT4 r2 iPhone 4 Native USB Tethering

    *** Part 1, Compiling package dependencies and Install: ***

    Make sure your BackTrack distro is up-to-date and you have the linux kernel source installed and ready to compile packages and modules. Follow the BackTrack 4 r2 update guide:
    (Upgrading - BackTrack Linux)

    Next we're going to install all the tools necessary to compile the various sources.
    Code:
    root@bt:/usr/src# apt-get install build-essential cmake automake autoconf libtool libgnutls-dev libglib2.0-dev libxml2-dev libreadline5-dev
    During this tutorial we'll be using the source package versions in the following link(s). As newer versions are released some of the compilation errors/nuances experienced on BackTrack should be eliminated:

    Sources and Versions:
    1. libusb-1.0.8 (git.stuge.se Git - libusb.git/summary)
    2. usbmuxd-1.0.6 (git.marcansoft.com Git - usbmuxd.git/summary)
    3. libplist-1.3 (http://github.com/JonathanBeck/libplist)
    4. libimobiledevice-1.0.3 (libimobiledevice - A protocol library to access an iPhone or iPod Touch in Linux)
    5. ipheth 1.0-1 (https://github.com/dgiagio/ipheth)

    *Please keep in mind that at each new section we're starting at '/usr/src/'.

    Part 1.1, libusb-1.0.8:

    Get Source
    Code:
    root@bt:/usr/src# git clone git://git.libusb.org/libusb.git
    ...
    Compile and Install
    Code:
    root@bt:/usr/src# cd libusb/
    root@bt:/usr/src/libusb# ./autogen.sh
    ...
    root@bt:/usr/src/libusb# make
    ...
    root@bt:/usr/src/libusb# make install
    Part 1.2, usbmuxd-1.0.6:

    Get Source
    Code:
    root@bt:/usr/src# git clone git://git.marcansoft.com/usbmuxd.git
    ...
    Compile
    Code:
    root@bt:/usr/src# cd usbmuxd/
    root@bt:/usr/src/usbmuxd# mkdir build
    root@bt:/usr/src/usbmuxd# cd build/
    root@bt:/usr/src/usbmuxd/build# cmake ..
    ...
    If you get the following compilation error:
    Code:
    ...
    -- libusbmuxd will be built with protocol version 1 support
    CMake Error: Error in cmake code at
    /usr/src/usbmuxd/Modules/FindUSB.cmake:13:
    Parse error.  Function missing ending ")".  Instead found left paren with text "(".
    CMake Error at daemon/CMakeLists.txt:1 (find_package):
      find_package Error reading CMake code from
      "/usr/src/usbmuxd/Modules/FindUSB.cmake".
    ...
    Make the following changes to '/usr/src/usbmuxd/Modules/FindUSB.cmake'. Adding the '#'s in front of the if/else check for FreeBSD will allow us to compile the code. Don't actually add the "below and above" comment lines they are simply there for reference.
    Code:
    # - Try to find libusb-1.0
    # Once done, this will define
    #
    #  USB_FOUND - system has libusb-1.0
    #  USB_INCLUDE_DIRS - the libusb-1.0 include directories
    #  USB_LIBRARIES - link these to use libusb-1.0
    
    include(LibFindMacros)
    
    # Dependencies
    
    ### ONLY MODIFY THE CODE BELOW THIS LINE ###
    
    # pkg-config + libusb fails on FreeBSD, though libusb is in base
    #if(NOT(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD"))
      # Use pkg-config to get hints about paths
      libfind_pkg_check_modules(USB_PKGCONF libusb-1.0>=1.0.3)
      # We want to look for libusb-1.0
      set(USB_LIBRARY_NAME usb-1.0)
    #else()
    #  set(USB_PKGCONF_INCLUDE_DIRS /usr/include)
    #  set(USB_PKGCONF_LIBRARY_DIRS /usr/lib)
    #  set(USB_LIBRARY_NAME usb)
    #endif()
    
    ### AND ABOVE THIS LINE ###
    
    ...
    Compile
    Code:
    root@bt:/usr/src/usbmuxd/build# cmake ..
    -- Configuring usbmuxd v1.0.6-dirty
    -- Found PLIST
    -- Will build usbmuxd: YES
    -- libusbmuxd will be built with protocol version 1 support
    -- checking for module 'libusb-1.0>=1.0.3'
    --   found libusb-1.0, version 1.0.8
    -- Found USB
    -- usbmuxd will be built with protocol version 1 support
    
    * REMINDER
    * Remember to add a user named 'usbmux' with USB access permissions
    * for the udev hotplugging feature to work out of the box.
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /usr/src/usbmuxd/build
    Note the REMINDER in the above output. We'll revisit that in Part 3.

    Code:
    root@bt:/usr/src/usbmuxd/build# make
    ...
    root@bt:/usr/src/usbmuxd/build# make install
    ...
    Part 1.3, libplist-1.3:

    Get Source
    Code:
    root@bt:/usr/src# git clone git://github.com/JonathanBeck/libplist.git
    ...
    Compile and Install
    Code:
    root@bt:/usr/src# cd libplist/
    root@bt:/usr/src/libplist# mkdir build
    root@bt:/usr/src/libplist# cd build/
    root@bt:/usr/src/libplist/build# cmake ..
    ...
    root@bt:/usr/src/libplist/build# make
    ...
    root@bt:/usr/src/libplist/build# make install
    Part 1.4, libimobiledevice-1.0.3:

    Get Source
    Code:
    root@bt:/usr/src# git clone git://git.sukimashita.com/libimobiledevice.git
    ...
    Compile and Install
    Code:
    root@bt:/usr/src# cd libimobiledevice/
    root@bt:/usr/src/libimobiledevice# ./autogen.sh
    ...
    root@bt:/usr/src/libimobiledevice# make
    ...
    root@bt:/usr/src/libimobiledevice# make install
    ...
    Part 1.5, ipheth 1.0-1:

    Get Source
    Code:
    root@bt:/usr/src# git clone git://github.com/dgiagio/ipheth.git
    ...
    Part 1.5.1, ipheth-driver:

    Compile and Install
    Code:
    root@bt:/usr/src# cd ipheth/ipheth-driver/
    root@bt:/usr/src/ipheth/ipheth-driver# make
    ...
    If the following compilation error is found, you'll need to patch the source as there have been some usb function name changes in kernel 2.6.35 and the following bug-fix has not made it's way to the repository.

    (git.kernel.org - linux/kernel/git/torvalds/linux-2.6.git/commitdiff)

    Code:
    root@bt:/usr/src/ipheth/ipheth-driver# make
    make -C /lib/modules/2.6.35.8/build M=/usr/src/ipheth/ipheth-driver modules
    make[1]: Entering directory `/usr/src/linux-source-2.6.35.8'
    
      WARNING: Symbol version dump /usr/src/linux-source-2.6.35.8/Module.symvers
               is missing; modules will have no dependencies and modversions.
    
      CC [M]  /usr/src/ipheth/ipheth-driver/ipheth.o
    /usr/src/ipheth/ipheth-driver/ipheth.c: In function ‘ipheth_alloc_urbs’:
    /usr/src/ipheth/ipheth-driver/ipheth.c:137: error: implicit declaration of function ‘usb_buffer_alloc’
    /usr/src/ipheth/ipheth-driver/ipheth.c:140: warning: assignment makes pointer from integer without a cast
    /usr/src/ipheth/ipheth-driver/ipheth.c:147: warning: assignment makes pointer from integer without a cast
    /usr/src/ipheth/ipheth-driver/ipheth.c:159: error: implicit declaration of function ‘usb_buffer_free’
    make[2]: *** [/usr/src/ipheth/ipheth-driver/ipheth.o] Error 1
    make[1]: *** [_module_/usr/src/ipheth/ipheth-driver] Error 2
    make[1]: Leaving directory `/usr/src/linux-source-2.6.35.8'
    make: *** [all] Error 2
    Again, only insert the below modifications into the '/usr/src/ipheth/ipheth-driver/ipheth.c' file if the above make command failed with the same error. Don't actually add the "below and above" comment lines they are simply there for reference.

    Code:
    ...
    #include <linux/ethtool.h>
    #include <linux/usb.h>
    #include <linux/workqueue.h>
    
    ### ONLY ADD THE CODE BELOW THIS LINE ###
    
    #include <asm/uaccess.h>
    #include <linux/version.h>
    #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)
    #  define usb_buffer_alloc(dev, size, mem_flags, dma) \
           usb_alloc_coherent(dev, size, mem_flags, dma)
    #  define usb_buffer_free(dev, size, addr, dma) \
           usb_free_coherent(dev, size, addr, dma)
    #endif
    
    ### AND ABOVE THIS LINE ###
    
    #define USB_VENDOR_APPLE        0x05ac
    #define USB_PRODUCT_IPHONE      0x1290
    #define USB_PRODUCT_IPHONE_3G   0x1292
    #define USB_PRODUCT_IPHONE_3GS  0x1294
    #define USB_PRODUCT_IPHONE_4    0x1297
    ...
    You should see something similar to the following output when the ipheth module compiles without error:

    Code:
    root@bt:/usr/src/ipheth/ipheth-driver# make
    make -C /lib/modules/2.6.35.8/build M=/usr/src/ipheth/ipheth-driver modules
    make[1]: Entering directory `/usr/src/linux-source-2.6.35.8'
    
      WARNING: Symbol version dump /usr/src/linux-source-2.6.35.8/Module.symvers
               is missing; modules will have no dependencies and modversions.
    
      CC [M]  /usr/src/ipheth/ipheth-driver/ipheth.o
      Building modules, stage 2.
      MODPOST 1 modules
      CC      /usr/src/ipheth/ipheth-driver/ipheth.mod.o
      LD [M]  /usr/src/ipheth/ipheth-driver/ipheth.ko
    make[1]: Leaving directory `/usr/src/linux-source-2.6.35.8'
    Install

    Code:
    root@bt:/usr/src/ipheth/ipheth-driver# make install
    make -C /lib/modules/2.6.35.8/build M=/usr/src/ipheth/ipheth-driver modules_install
    make[1]: Entering directory `/usr/src/linux-source-2.6.35.8'
      INSTALL /usr/src/ipheth/ipheth-driver/ipheth.ko
      DEPMOD  2.6.35.8
    make[1]: Leaving directory `/usr/src/linux-source-2.6.35.8'
    Part 1.5.2, ipheth-pair:
    Code:
    root@bt:/usr/src# cd ipheth/ipheth-pair/
    root@bt:/usr/src/ipheth/ipheth-pair# make
    ...
    root@bt:/home/spyder/src/ipheth/ipheth-pair# make install
    install -m 0755 ipheth-pair /lib/udev/
    install -m 0644 90-iphone-tether.rules /etc/udev/rules.d
    /sbin/udevadm control --reload-rules
    unrecognized command 'reload-rules'
    make: *** [install] Error 1
    BackTrack 4 r2 uses an older version of udev; for our version the correct syntax is `udevadm control --reload_rules`. Don't worry about the error as we'll revisit this in part 3.

  3. #3
    Just burned his ISO
    Join Date
    Sep 2010
    Posts
    15

    Default Re: Fix: BT4 r2 iPhone 4 Native USB Tethering

    *** Part 2, Test, Debug, and Manual Pairing: ***

    *Before you continue link the newly installed libraries
    Code:
    root@bt:/usr/src# ldconfig
    As we test and debug we're going to use the following groups of commands to monitor the kernel message buffer and collect information on whether the ipheth module recognized your iPhone. You'll probably want more than one terminal window open for this section.

    *Disable the auto lock on your iPhone if it's enabled, enable tethering through USB, and plug in your iPhone via a USB cable.

    Check to see if your system automatically recognized it.
    Code:
    root@bt:/usr/src# dmesg
    ...
    usb 1-2: new high speed USB device using ehci_hcd and address 4
    root@bt:/usr/src# dmesg | grep ipheth
    root@bt:/usr/src# dmesg | grep iPhone
    or continually monitor the kernel message buffer using

    Code:
    root@bt:/usr/src# tail -f /var/log/messages
    Notice that nothing in the kernel message buffer was returned about either ipheth or the iPhone. At this point, this is the expected result.

    Part 2.1, Remove the OLD ipheth kernel module and Load the NEW ipheth kernel module:

    "This is the Linux Kernel driver that adds support for iPhone tethering through USB cables. Unlike other solutions out there, you don't need to jailbreak your phone or install third-party proxy applications."


    Code:
    root@bt:/usr/src# modprobe -r ipheth
    root@bt:/usr/src# insmod /usr/src/ipheth/ipheth-driver/ipheth.ko
    root@bt:/usr/src# lsmod | grep ipheth
    ipheth                  4859  0
    Check the kernel message buffer
    Code:
    root@bt:/usr/src# dmesg
    ...
    usb 1-2: new high speed USB device using ehci_hcd and address 4
    usbcore: registered new interface driver ipheth
    root@bt:/usr/src# dmesg | grep iPhone
    root@bt:/usr/src# dmesg | grep ipheth
    usbcore: registered new interface driver ipheth
    Notice that the ipheth driver was registered, but still nothing in the kernel message buffer was returned about the ipheth driver recognizing the iPhone. At this point, this is still the expected result.

    Part 2.2, Start the usbmux daemon in debug mode with root privileges:

    "USB Multiplex Daemon. This bit of software is in charge of talking to your iPhone or iPod Touch over USB and coordinating access to its services by other applications."


    Start usbmuxd as root in debug mode
    Code:
    root@bt:/usr/src# usbmuxd -f -v -v
    [10:53:38.269][3] usbmuxd v1.0.6-dirty starting up
    [10:53:38.270][4] Creating socket
    [10:53:38.270][5] client_init
    [10:53:38.270][5] device_init
    [10:53:38.270][4] Initializing USB
    [10:53:38.270][5] usb_init for linux / libusb 1.0
    [10:53:38.272][4] Found new device with v/p 05ac:1297 at 1-4
    [10:53:38.278][4] Found interface 1 with endpoints 04/85 for device 1-4
    [10:53:38.280][4] Using wMaxPacketSize=512 for device 1-4
    [10:53:38.280][3] Connecting to new device on location 0x10004 as ID 1
    [10:53:38.280][4] 1 device detected
    [10:53:38.280][3] Initialization complete
    [10:53:38.280][3] Connected to v1.0 device 1 on location 0x10004 with serial number xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    [10:53:38.281][5] client_device_add: id 1, location 0x10004, serial xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Check the kernel message buffer
    Code:
    root@bt:/usr/src# dmesg
    ...
    usb 1-2: new high speed USB device using ehci_hcd and address 4
    usbcore: registered new interface driver ipheth
    ipheth 1-2:4.2: Apple iPhone USB Ethernet device attached
    root@bt:/usr/src# dmesg | grep iPhone
    ipheth 1-2:4.2: Apple iPhone USB Ethernet device attached
    root@bt:/usr/src# dmesg | grep ipheth
    usbcore: registered new interface driver ipheth
    Notice that the ipheth driver has recognized the iPhone.

    Check the list of network interfaces now available. Interface eth1 should now be available; however, it is not yet "up".
    Code:
    root@bt:/usr/src/ipheth/ipheth-driver# ifconfig -a
    ...
    eth1      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
    ...
    Part 2.3, Manually Pairing the iPhone:

    "The pairing program is necessary in order to do a handshake and pair the device with the computer, otherwise it won't respond to kernel driver requests and thus won't work."

    Start the ipheth-pair utility
    Code:
    root@bt:/usr/src# /lib/udev/ipheth-pair
    Part 2.4, Networking:

    We're going to use the Network Manager to automatically put the interface up and pull the network information (IP address , gateway, and DNS servers) from the iPhone.

    Code:
    root@bt:/usr/src# start-network
    You should now have an IP address for eth1. You should also now see a blue stripe across the top of your iPhone saying "Internet Tethering".

    Code:
    root@bt:/usr/src# ifconfig -a
    ...
    eth1      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
              inet addr:172.xx.xx.xx  Bcast:172.xx.xx.xx  Mask:255.255.255.240
              inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:663 errors:0 dropped:0 overruns:0 frame:0
              TX packets:163 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:121730 (121.7 KB)  TX bytes:21829 (21.8 KB)
    ...
    We're now going to see if you can reach the external network. This may take a little longer than normal.
    Code:
    root@bt:/usr/src# ping www.google.com
    PING www.l.google.com (74.125.45.104) 56(84) bytes of data.
    64 bytes from yx-in-f104.1e100.net (74.125.45.104): icmp_seq=1 ttl=53 time=519 ms
    64 bytes from yx-in-f104.1e100.net (74.125.45.104): icmp_seq=2 ttl=53 time=470 ms
    ^C64 bytes from yx-in-f104.1e100.net (74.125.45.104): icmp_seq=3 ttl=53 time=339 ms
    --- www.l.google.com ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 1999ms
    rtt min/avg/max/mdev = 339.138/442.888/519.361/76.065 ms
    Troubleshooting:
    If you don't see the blue stripe across your iPhone, make sure the ipheth-driver module is loaded, usbmuxd is running, and that your iPhone's auto lock is disabled, tethering through USB is enabled, and that the iPhone is connected via a working USB cable. Failing that check your debug output from dmesg and usbmuxd to see if the iPhone was recognized.

    If you do see the blue stripe across your iPhone, but you can't ping 'www.google.com', try pinging 8.8.8.8. If this works, you may have to set your DNS servers manually. You can use google's DNS or OpenDNS servers. Follow these directions:

    Kmenu->Internet->Wicd Network Manager

    or run

    Code:
    root@bt:/usr/src/ipheth/ipheth-pair# wicd-gtk
    ...
    At the main wicd network manager page select the "Preferences" page and change your "Wired interface" to 'eth1'. If you want you can select "Always switch to a wired connection when available". Hit 'OK'.

    Back at the main wicd network manager page select the "Properties" for your "Wired Network". Make sure 'Use Static DNS' is checked. You can use Google's 8.8.8.8 and 8.8.4.4 for DNS 1 and 2. Select 'OK'.

    Back at the main wicd network manager page click the "Connect" button for your "Wired Network".

  4. #4
    Just burned his ISO
    Join Date
    Sep 2010
    Posts
    15

    Default Re: Fix: BT4 r2 iPhone 4 Native USB Tethering

    *** Part 3, Automatic Pairing using udev rules: ***

    "udev is the device manager for the Linux 2.6 kernel series. Primarily, it manages device nodes in /dev. It is the successor of devfs and hotplug, which means that it handles the /dev directory and all user space actions when adding/removing devices, including firmware load."

    For more information on udev see:

    (https://wiki.archlinux.org/index.php/Udev)
    (Writing udev rules)

    There will be two udev rules that we'll need for this setup. Both of these files were included with their respective packages; however, neither works out of the box and will take some modifications to get them to work properly.

    When your iPhone is connected, you can use the following udev command to look at the information for your device.

    Code:
    root@bt:/usr/src# udevinfo -a -p /sys/class/net/eth1
    Part 3.1, '/lib/udev/rules.d/85-usbmuxd.rules':

    Is responsible for automatically launching usbmuxd when you plug in your iPhone.

    Remember when we were compiling usbmuxd, there was a reminder to:
    "Remember to add a user named 'usbmux' with USB access permissions for the udev hotplugging feature to work out of the box".

    Let's go ahead and create the new user "usbmux" as part of the "plugdev" group:
    Code:
    root@bt:/usr/src# useradd -g plugdev -u 124 -s /bin/false -c "usbmux daemon" usbmux
    Next we're going to move the '/lib/udev/rules.d/85-usbmuxd.rules' to '/etc/udev/rules.d/' as I've never had success with having the udev rule run automatically from '/lib/udev/rules.d/'
    Code:
    root@bt:/usr/src# mv /lib/udev/rules.d/85-usbmuxd.rules /etc/udev/rules.d/
    We need to make the following modifications to your '/etc/udev/rules.d/85-usbmuxd.rules' file to enable debugging and give it the correct group and user permissions.
    Code:
    # usbmuxd (iPhone "Apple Mobile Device" MUXer listening on /var/run/usbmuxd)
    
    # Forces iPhone 1.0, 3G, 3GS, iPodTouch 1/2 and iPad to USB configuration 3 and run usbmuxd
    ACTION=="add", SUBSYSTEM=="usb", GROUP="plugdev", MODE="0666", ATTR{idVendor}=="05ac", ATTR{idProduct}=="129[0-9a-f]", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}!="$attr{bNumConfigurations}", ATTR{bConfigurationValue}="$attr{bNumConfigurations}", RUN+="/usr/local/sbin/usbmuxd -u -U usbmux -v -v"
    
    # Exit usbmuxd when the last device is removed
    ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/129[0-9a-f]/*", ENV{INTERFACE}=="255/*", RUN+="/usr/local/sbin/usbmuxd -x -v -v"

    Part 3.2, '/etc/udev/rules.d/90-iphone-tether.rules':

    Is responsible for automatically launching the ipheth-pair utility once an interface using the ipheth module is created.

    Modify '/etc/udev/rules.d/90-iphone-tether.rules' to look like this:
    Code:
    # udev rules for setting correct configuration and pairing on tethered iPhones
    
    # Execute pairing program when appropriate
    
    ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ipheth", SYMLINK+="iphone", RUN+="/lib/udev/ipheth-pair"
    Part 3.3, Putting it all together:

    Next we're going to get the ipheth driver module to load each time you reboot so we don't have to manually load it each time you connect your iPhone.

    Create a backup of the original ipheth kernel module, and move the new one into '/lib/modules/2.6.35.8/kernel/drivers/net/usb/'
    Code:
    root@bt:/usr/src# mv /lib/modules/2.6.35.8/kernel/drivers/net/usb/ipheth.ko /lib/modules/2.6.35.8/kernel/drivers/net/usb/ipheth.ko.bak
    root@bt:/usr/src# cp /usr/src/ipheth/ipheth-driver/ipheth.ko /lib/modules/2.6.35.8/kernel/drivers/net/usb/
    Add ipheth to the list of modules to load at boot
    Code:
    root@bt:/usr/src# echo "ipheth" >> /etc/modules
    root@bt:/usr/src# cat /etc/modules
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    ...
    ipheth
    Remove the ipheth module if it's still loaded, and reload it to make sure we're pulling the correct version.
    Code:
    root@bt:/usr/src# lsmod | grep ipheth
    ipheth                  4859  0
    root@bt:/usr/src# modprobe -r ipheth
    root@bt:/usr/src# modprobe ipheth
    Next, check to see if usbmuxd is running, and kill the process using its PID if it is running.
    Code:
    root@bt:/usr/src# ps -ef | grep usbmuxd
    root      6641  6303  0 10:53 pts/2    00:00:07 usbmuxd -f -v -v
    root      9563  7703  0 11:46 pts/3    00:00:00 grep usbmuxd
    root@bt:/usr/src# kill -9 6641
    Tell udevadm to reload the new rules and trigger which will cause udev to rerun through all the rules again. We'll also check to see if usbmuxd was automatically run with the correct parameters.

    Code:
     
    root@bt:/usr/src# udevadm control reload_rules
    root@bt:/usr/src# udevadm trigger
    root@bt:/usr/src# ps -ef | grep usbmuxd
    usbmux   12559     1  0 12:31 ?        00:00:00 /usr/local/sbin/usbmuxd -u -U usbmux -v -v
    root     12788  6303  0 12:31 pts/2    00:00:00 grep usbmuxd
    Run the network manager if necessary.
    Code:
    root@bt:/usr/src# start-network
    At this point, anytime after you plug in your iPhone it should be automatically paired and will show the blue stripe across the top that says "Internet Tethering".

    *Just don't forget to setup the Wicd Network Manager to automatically put the wired interface up and pull the network information.

    *** Happy Tethering! ***

  5. #5
    Just burned his ISO mania's Avatar
    Join Date
    Aug 2010
    Posts
    4

    Default Re: Fix: BT4 r2 iPhone 4 Native USB Tethering

    firstly, thank you for the post. But I have problem compiling ipheth because header file missing.

    Code:
    /usr/src/ipheth/ipheth-pair#make
    c -Wall -O2   -c -o ipheth-pair.o ipheth-pair.c
    ipheth-pair.c:25:39: error: libimobiledevice/lockdown.h: No such file or directory
    ipheth-pair.c: In function ‘main’:
    ipheth-pair.c:35: error: ‘idevice_error_t’ undeclared (first use in this function)
    ipheth-pair.c:35: error: (Each undeclared identifier is reported only once
    ipheth-pair.c:35: error: for each function it appears in.)
    ipheth-pair.c:35: error: expected ‘;’ before ‘rv’
    ipheth-pair.c:36: error: ‘idevice_t’ undeclared (first use in this function)
    ipheth-pair.c:36: error: expected ‘;’ before ‘device’
    ipheth-pair.c:37: error: ‘lockdownd_client_t’ undeclared (first use in this function)
    ipheth-pair.c:37: error: expected ‘;’ before ‘client’
    ipheth-pair.c:65: error: ‘rv’ undeclared (first use in this function)
    ipheth-pair.c:65: warning: implicit declaration of function ‘idevice_get_device_list’
    ipheth-pair.c:72: warning: implicit declaration of function ‘idevice_new’
    ipheth-pair.c:72: error: ‘device’ undeclared (first use in this function)
    ipheth-pair.c:74: warning: implicit declaration of function ‘lockdownd_client_new’
    ipheth-pair.c:74: error: ‘client’ undeclared (first use in this function)
    ipheth-pair.c:76: warning: implicit declaration of function ‘lockdownd_get_device_name’
    ipheth-pair.c:77: warning: implicit declaration of function ‘lockdownd_client_free’
    ipheth-pair.c:79: warning: implicit declaration of function ‘idevice_free’
    ipheth-pair.c:88: warning: implicit declaration of function ‘idevice_device_list_free’
    ipheth-pair.c:105: warning: implicit declaration of function ‘lockdownd_validate_pair’
    ipheth-pair.c:108: warning: implicit declaration of function ‘lockdownd_pair’
    make: *** [ipheth-pair.o] Error 1
    . Do you have any idea??

  6. #6
    Just burned his ISO
    Join Date
    Sep 2010
    Posts
    15

    Default Re: Fix: BT4 r2 iPhone 4 Native USB Tethering

    Quote Originally Posted by mania View Post
    I have problem compiling ipheth because header file missing... Do you have any idea??
    The ipheth-pair utility is heavily dependent on libimobiledevice, and from your above compilation error it seems to have not been completely/successfully installed.

    Can you confirm the 100% successful compile and install for "Part 1.4, libimobiledevice-1.0.3"?

Similar Threads

  1. Replies: 1
    Last Post: 11-28-2010, 07:31 PM
  2. iPhone 3gs tethering on BT4 final request
    By bg47pl in forum Beginners Forum
    Replies: 4
    Last Post: 05-12-2010, 01:49 PM
  3. iPhone tethering on BT4 final
    By lukanio in forum OLD BackTrack 4 General Support
    Replies: 0
    Last Post: 02-02-2010, 02:02 PM
  4. iPhone tethering in Backtrack
    By infosecpentester in forum OLD BackTrack 4 (pre) Final
    Replies: 1
    Last Post: 08-05-2009, 08:11 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
  •