Hardware: Configuration: FireWire (ieee1394) iPod


Results 1 to 1 of 1

Thread: Hardware: Configuration: FireWire (ieee1394) iPod

  1. #1
    Join Date
    Oct 2000
    Location
    Calgary, Alberta, Canada
    Posts
    8,130

    Hardware: Configuration: FireWire (ieee1394) iPod

    The iPod mounts like a hard disk. In fact, they are very handy to use for transporting any type of files from system to system in addition to being a great portable music player.

    directory listing of a mounted iPod
    Code:
    [ ddicks@linuxbox /mnt/ipod ] $ ll
    total 12
    drwxrwxrwx    2 ddicks   users        4096 Jan  1  1980 Calendars
    drwxrwxrwx    2 ddicks   users        4096 Mar 15  2003 Contacts
    drwxrwxrwx    6 ddicks   users        4096 Feb  8  2003 iPod_Control
    The iPod is fully functional - even to the point of being able to use the new aac files if you use GtkPod.

    I have a Mac iPod that I reformatted to VFAT (you have to reformat them to VFAT for it to work, the support for the Mac File System is not good enough under Linux kernels yet) that I hook up with FireWire. I installed some iPod software on a Windows XP PC and used that to format it to VFAT.

    For a FireWire iPod, you need the following kernel modules:

    IEEE 1394 (FireWire) support (EXPERIMENTAL)
    OHCI-1394 support
    SBP-2 support (Harddisks etc.)
    Raw IEEE1394 I/O support

    The iPod will be mounted like a scsi drive.
    /dev/sda2 /mnt/ipod vfat defaults,user,noauto,sync,umask=000 0 0

    It is mounted as sda2 because when the modules are loaded and the iPod is connected, sda1 is the iPod firmware.

    I leave these modules running all the time:
    ieee1394, ohci1394, raw1394

    I load the vfat and sbp2 modules in the ~/.gtkpod/gtkpod.in script when the GtkPod program loads, and unload them when it exits ~/.gtkpod/gtkpod.out

    I use a script to rescan the SCSI bus after the iPod is connected and the modules are loaded. I didn't always do this but something changed with Gentoo at some point and it no longer creates the devices properly when the modules get loaded so I run the following after i modprobe the module(s) in the gtkpod.in script. ***NOTE: This script IS NOT NEEDED for Kernel 2.6.x

    Code:
    #!/bin/bash
    # Skript to rescan SCSI bus, using the 
    # scsi add-single-device mechanism
    # (w) 98/03/19 Kurt Garloff  (c) GNU GPL
    
    # Return hosts. /proc/scsi/HOSTADAPTER/? must exist
    findhosts ()
    {
      hosts=
      for name in /proc/scsi/*/?; do
        name=${name#/proc/scsi/}
        if test ! $name = scsi
          then hosts="$hosts ${name#*/}"
          echo "Host adapter ${name#*/} (${name%/*}) found."
        fi
      done
    }
    
    # Test if SCSI device $host $channen $id $lun exists
    # Outputs description from /proc/scsi/scsi, returns new
    testexist ()
    {
      grepstr="scsi$host Channel: 0$channel Id: 0*$id Lun: 0$lun"
      new=`cat /proc/scsi/scsi|grep -e"$grepstr"`
      if test ! -z "$new"
        then cat /proc/scsi/scsi|grep -e"$grepstr"
        cat /proc/scsi/scsi|grep -A2 -e"$grepstr"|tail -2|pr -o4 -l1
      fi
    }
    
    # Perform search (scan $host)
    dosearch ()
    {
      for channel in $channelsearch; do
        for id in $idsearch; do
          for lun in $lunsearch; do
            new=
    	devnr="$host $channel $id $lun"
    	echo "Scanning for device $devnr ..."
    	printf "OLD: "
    	testexist
    	if test ! -z "$remove" -a ! -z "$new"
    	  then echo "scsi remove-single-device $devnr" >/proc/scsi/scsi
    	  echo "scsi add-single-device $devnr" >/proc/scsi/scsi
    	  printf "\r\x1b[A\x1b[A\x1b[AOLD: "
    	  testexist
    	  if test -z "$new"; then printf "\rDEL: \r\n\n\n\n"; let rmvd+=1; fi
    	fi
    	if test -z "$new"
    	  then printf "\rNEW: "
    	  echo "scsi add-single-device $devnr" >/proc/scsi/scsi
    	  testexist
    	  if test -z "$new"; then printf "\r\x1b[A"; else let found+=1; fi
    	fi
          done
        done
      done
    }
    	  
      
    # main
    if test @$1 = @--help -o @$1 = @-h
      then 
        echo "Usage: rescan-scsi-bus.sh [-l] [-w] [-c] [host [host ...]]"
        echo " -l activates scanning for LUNs 0 .. 7 [default: 0]"
        echo " -w enables scanning for device IDs 0 .. 15 [def.: 0 .. 7]"
        echo " -r enables removing of devices        [default: disabled]"
        echo " -c enables scanning of channels 0 1   [default: 0]"
        echo " If hosts are given, only these are scanned [default: all]"
        exit 0
    fi
    
    # defaults
    lunsearch="0"
    idsearch="0 1 2 3 4 5 6 7"
    channelsearch="0"
    remove=""
    
    # Scan options
    opt="$1"
    while test ! -z "$opt" -a -z "${opt##-*}"; do
      opt=${opt#-}
      case "$opt" in
        l) lunsearch="0 1 2 3 4 5 6 7" ;;
        w) idsearch="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" ;;
        c) channelsearch="0 1" ;;
        r) remove=1 ;;
        *) echo "Unknown option -$opt !" ;;
      esac
      shift
      opt="$1"
    done    
    
    # Hosts given ?
    if test @$1 = @; then findhosts; else hosts=$*; fi
    
    declare -i found=0
    declare -i rmvd=0
    for host in $hosts; do dosearch; done
    echo "$found new device(s) found.               "
    echo "$rmvd device(s) removed.                 "
    The best thing to do is to set up your sudoers file with the following commands in a Command Alias entry so you can just use sudo in the gtkpod.in and gtkpod.out scripts.

    Code:
    /sbin/modprobe vfat
    /sbin/modprobe raw1394
    /sbin/modprobe sbp2 sbp2_force_inquiry_hack=1
    /sbin/rmmod sbp2
    /sbin/rmmod vfat
    /sbin/rmmod fat
    /sbin/rmmod raw1394, /usr/bin/rescan-scsi-bus.sh
    ***NOTE: the sbp2_force_inquiry_hack=1 IS NOT NEEDED for Kernel 2.6.x

    Here are my gtkpod.in and gtkpod.out scripts:
    ***NOTE: the sbp2_force_inquiry_hack and rescan_scsi_bus.sh are NOT NEEDED for 2.6.x Kernels

    gtkpod.in
    Code:
    if /sbin/lsmod | grep vfat;
            then
                    /bin/true;
            else
                    sudo /sbin/modprobe vfat
    fi
    
    if /sbin/lsmod | grep sbp2;
            then
                    /bin/true
            else
                    sudo /sbin/modprobe sbp2 sbp2_force_inquiry_hack=1
    fi
    
    sudo /usr/bin/rescan-scsi-bus.sh
    gtkpod.out
    Code:
    sudo /sbin/rmmod sbp2
    #sudo /sbin/rmmod 1394
    
    sudo /sbin/rmmod vfat
    
    sudo /usr/bin/rescan-scsi-bus.sh
    sbp2 works better if you pass the following parameter to it when you modprobe it.
    /sbin/modprobe sbp2 sbp2_force_inquiry_hack=1***NOTE: the sbp2_force_inquiry_hack=1 IS NOT NEEDED for Kernel 2.6.x

    The entire firewire system in the kernel is more stable if all of your "Input Core Support" (keyboard/mouse/all of it) stuff is modularized - don't ask me why - I don't know - it just works better. :)

    PS: Some kernels have really buggy firewire support, I use the latest Wolk kernel and it is pretty stable. If you can get a usb2 iPod, it may work better for you if you know that firewire (ieee1394) is buggy in your kernel.

    PPS: I am now using 2.6.x, I have tested with 2.6.x-love-sources and 2.6.x-mm-sources - both of which have broken firewire. *** This issue is resolved since 2.6.4 ***
    Attached Files Attached Files
    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •