Usbmuxd with resin.io


#1

Hi,

I’m trying to get my iPhone detected by my raspberry pi. I’m installing the latest libimobile, but usbmuxd doesn’t seem to start when I connect my phone.

This is my Dockerfile:

FROM resin/rpi-raspbian:wheezy-2015-01-15

# Upgrade and install packages
RUN apt-get update && apt-get upgrade -y && apt-get install -y dropbear libusb-1.0-0 libusb-1.0-0-dev net-tools git make automake autoconf libtool pkg-config gcc g++ libxml2-dev python python-dev

# clone packages
RUN git clone https://github.com/libimobiledevice/libplist.git
RUN git clone https://github.com/libimobiledevice/libusbmuxd.git
RUN git clone https://github.com/libimobiledevice/libimobiledevice.git
RUN git clone https://github.com/libimobiledevice/usbmuxd.git

# build packages
RUN cd libplist && ./autogen.sh --prefix=/usr/ && make && make install
RUN cd libusbmuxd && ./autogen.sh --prefix=/usr/ && make && make install
RUN cd libimobiledevice && ./autogen.sh --prefix=/usr/ && make && make install
RUN cd usbmuxd && ./autogen.sh --prefix=/usr/ && make && make install
RUN cd usbmuxd && cp ./udev/39-usbmuxd.rules /etc/udev/rules.d

COPY . /app
RUN chmod a+x /app/start_apps.sh

CMD /app/start_apps.sh

My start_apps.sh looks like this:

#!/bin/bash
# make sure udev works
mount -t devtmpfs none /dev
udevd &
udevadm trigger

#Set the root password
echo "root:$PASSWD" | chpasswd
#Spawn dropbear
dropbear -E -F

However, despite the udev rules file, usbmuxd does not start when my I connect my phone.

the udev rules file, which was located in the usbmixd folder, and is being copied to rules.d, looks like this:

# usbmuxd (Apple Mobile Device Muxer listening on /var/run/usbmuxd)

# Initialize iOS devices into "deactivated" USB configuration state and activate usbmuxd
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="12[9a][0-9a-f]", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}="0", OWNER="usbmux", TAG+="systemd", ENV{SYSTEMD_WANTS}="usbmuxd.service"

# Exit usbmuxd when the last device is removed
ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ENV{INTERFACE}=="255/*", RUN+="/usr/sbin/usbmuxd -x"

Any ideas?


#2

Hi,

The udev rules are supposed to trigger systemd. See the TAG+="systemd", ENV{SYSTEMD_WANTS}="usbmuxd.service" part. This means that you have run systemd in your container, and to do this you’ll have to use a debian-jessie image, since wheezy is too old for systemd.

Try replacing your FROM with FROM resin/raspberrypi-systemd:jessie and also adding ENV INITSYSTEM on. You can read more about it here https://hub.docker.com/r/resin/raspberrypi-systemd/

In this environment udev triggers should work as expected