From 19fbd9911e8f9990375c5b71c9540f5ad6fb386f Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 23 May 2009 20:59:04 +0200 Subject: [PATCH] Make udev rules set the right usb config and create pretty usbmux symlinks --- udev/85-usbmuxd.rules.in | 34 ++++++++++------------------------ 1 files changed, 10 insertions(+), 24 deletions(-) diff --git a/udev/85-usbmuxd.rules.in b/udev/85-usbmuxd.rules.in index 7820a36..8aca2ce 100644 --- a/udev/85-usbmuxd.rules.in +++ b/udev/85-usbmuxd.rules.in @@ -1,35 +1,21 @@ # usbmuxd (iPhone "Apple Mobile Device" MUXer listening on /var/run/usbmuxd) -#if -#SUBSYSTEMS=="usb_interface", SYMLINK+="usbmux/interface" -#SUBSYSTEMS!="usb", GOTO="usbmuxd_rules_end" # stops the whole script working -ATTR{idVendor}!="05ac", GOTO="usbmuxd_rules_end" +# Skip anything non Apple +ACTION=="add|remove", SUBSYSTEM!="usb|usb_endpoint", ATTRS{idVendor}!="05ac", GOTO="usbmuxd_rules_end" -# If it's plug insertion, flip it into dual "PTP + Apple Mobile Device" configuration -# This allows another application to switch it later without it getting switched back (hopefully) -# TODO: check iPod Touch/3G -SUBSYSTEM=="usb", ACTION=="add", ATTR{product}=="iPhone", ATTR{bConfigurationValue}!="3", ATTR{bConfigurationValue}="3", GOTO="usbmuxd_rules_end" +# Forces iPhone 1.0, 3G and iPodTouch 1 and 2 to USB configuration 3 +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="1290|1291|1292|1293", ATTR{bConfigurationValue}!="3", ATTR{bConfigurationValue}="3", GOTO="usbmuxd_rules_end" -# SYMLINK the usbmux endpoints, if we get them -# TODO: Multiple devices -# TODO: work out how to make nice, incrementing usbmux/{0,1,2,3}-in for LABEL="usbmuxd_rules_usbmux" -# ff/fe/02 == usbmux -# -#ACTION=="add", +# Only apply to usb endpoints +ACTION=="add|remove", SUBSYSTEM!="usb_endpoint", GOTO="usbmuxd_rules_end" -# Try to symlink the interface, containing the endpoints. -# ...But it doesn't work -#KERNELS=="7-3:3.1", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="01", ATTRS{bAlternateSetting}==" 0", ATTRS{bNumEndpoints}=="02", ATTRS{bInterfaceClass}=="ff", ATTRS{bInterfaceSubClass}=="fe", ATTRS{bInterfaceProtocol}=="02", SYMLINK+="usbmux/prettyplease", RUN+="/bin/ls -l /dev/usbmux/prettyplease" +# Setup cute names for the endpoints +ACTION=="add", SUBSYSTEM=="usb_endpoint", KERNEL=="usbdev*_ep04", SYMLINK+="usbmux/%s{serial}/%s{direction}" +ACTION=="add", SUBSYSTEM=="usb_endpoint", KERNEL=="usbdev*_ep85", SYMLINK+="usbmux/%s{serial}/%s{direction}" -#ATTRS{bInterfaceClass}=="ff", ATTRS{bInterfaceSubClass}=="fe", ATTRS{bInterfaceProtocol}=="02", SYMLINK+="usbmux/interface" - -# Cute names, really they should have nice numerically increasing names. -ACTION=="add", SUBSYSTEM=="usb_endpoint", KERNEL=="usbdev*_ep04", SYMLINK+="usbmux/in" -ACTION=="add", SUBSYSTEM=="usb_endpoint", KERNEL=="usbdev*_ep85", SYMLINK+="usbmux/out" - -# Start and stop 'usbmuxd' as required. +# Start and stop 'usbmuxd' as required ACTION=="add", SUBSYSTEM=="usb_endpoint", KERNEL=="usbdev*_ep85", RUN+="/sbin/start-stop-daemon --start --oknodo --exec @prefix@/sbin/usbmuxd" ACTION=="remove", SUBSYSTEM=="usb_endpoint", KERNEL=="usbdev*_ep85", RUN+="/sbin/start-stop-daemon --stop --signal 3 --exec @prefix@/sbin/usbmuxd" -- 1.6.0.2