commit usbmuxd for openSUSE:Factory

Hello community, here is the log from the commit of package usbmuxd for openSUSE:Factory checked in at Thu Mar 31 10:03:11 CEST 2011. -------- --- usbmuxd/usbmuxd.changes 2010-12-09 01:05:06.000000000 +0100 +++ /mounts/work_src_done/STABLE/usbmuxd/usbmuxd.changes 2011-03-24 17:51:17.000000000 +0100 @@ -1,0 +2,13 @@ +Thu Mar 24 17:45:01 CEST 2011 - opensuse@sukimashita.com + +- Create and use "usbmux" user in %pre to fix bno#679159 + +------------------------------------------------------------------- +Thu Mar 24 11:25:01 CEST 2011 - opensuse@sukimashita.com + +- Update to version 1.0.7 + * Detect iPad 2 and upcoming next generation iPhone devices + * Fix support for ancient devices running iOS 1.x + * Optionally use inotify instead of polling to safe energy + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- _service:download_url:usbmuxd-1.0.6.tar.bz2 New: ---- _service:download_url:usbmuxd-1.0.7.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ usbmuxd.spec ++++++ --- /var/tmp/diff_new_pack.c0o4GZ/_old 2011-03-31 09:59:21.000000000 +0200 +++ /var/tmp/diff_new_pack.c0o4GZ/_new 2011-03-31 09:59:21.000000000 +0200 @@ -1,7 +1,7 @@ # -# spec file for package usbmuxd (Version 1.0.6) +# spec file for package usbmuxd # -# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,8 +19,8 @@ Name: usbmuxd %define _libname libusbmuxd -Version: 1.0.6 -Release: 2 +Version: 1.0.7 +Release: 1 License: LGPL v2.1 or GPL v2 Summary: Socket daemon for the usbmux protocol of iPhone/iPod Touch devices Url: http://git.marcansoft.com/?p=usbmuxd.git @@ -32,6 +32,7 @@ BuildRequires: libusb-1_0-devel >= 1.0.3 BuildRequires: pkg-config BuildRequires: udev +Requires(pre): pwdutils BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -79,6 +80,10 @@ It allows you to map a port of a service running on the device (like sshd) and redirect it to your local machine where you can interact with it. +%pre +getent passwd usbmux >/dev/null || useradd -r -g nogroup -d /var/lib/%{name} -s /sbin/nologin -c "%{name} daemon" usbmux +exit 0 + %prep %setup -q @@ -105,6 +110,8 @@ %install cd build %{__make} install DESTDIR=%{buildroot} +# make sure the device gets owned by the usbmux user +sed -i 's@RUN+="/usr/sbin/usbmuxd -u -U usbmux"@OWNER="usbmux", RUN+="/usr/sbin/usbmuxd -u -U usbmux"@' %{buildroot}/lib/udev/rules.d/85-usbmuxd.rules %clean rm -rf %{buildroot} ++++++ _service ++++++ --- /var/tmp/diff_new_pack.c0o4GZ/_old 2011-03-31 09:59:21.000000000 +0200 +++ /var/tmp/diff_new_pack.c0o4GZ/_new 2011-03-31 09:59:21.000000000 +0200 @@ -1,7 +1,7 @@ <services> <service name="download_url"> - <param name="host">marcansoft.com</param> - <param name="protocol">http</param> - <param name="path">/uploads/usbmuxd/usbmuxd-1.0.6.tar.bz2</param> - </service> + + + + <param name="host">marcansoft.com</param><param name="path">/uploads/usbmuxd/usbmuxd-1.0.7.tar.bz2</param><param name="protocol">http</param></service> </services> \ No newline at end of file ++++++ _service:download_url:usbmuxd-1.0.6.tar.bz2 -> _service:download_url:usbmuxd-1.0.7.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/Modules/FindInotify.cmake new/usbmuxd-1.0.7/Modules/FindInotify.cmake --- old/usbmuxd-1.0.6/Modules/FindInotify.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/usbmuxd-1.0.7/Modules/FindInotify.cmake 2011-03-15 12:35:15.000000000 +0100 @@ -0,0 +1,11 @@ +set(INOTIFY_H "NOTFOUND") +find_file(INOTIFY_H + "sys/inotify.h" + PATHS ENV INCLUDE +) + +if (INOTIFY_H) + set(INOTIFY_FOUND TRUE) +else() + set(INOTIFY_FOUND FALSE) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/daemon/usb-linux.c new/usbmuxd-1.0.7/daemon/usb-linux.c --- old/usbmuxd-1.0.6/daemon/usb-linux.c 2010-09-28 03:32:44.000000000 +0200 +++ new/usbmuxd-1.0.7/daemon/usb-linux.c 2011-03-15 12:35:15.000000000 +0100 @@ -334,16 +334,23 @@ usbmuxd_log(LL_WARNING, "Endpoint count mismatch for interface %d of device %d-%d", intf->bInterfaceNumber, bus, address); continue; } - if((intf->endpoint[0].bEndpointAddress & 0x80) != LIBUSB_ENDPOINT_OUT || - (intf->endpoint[1].bEndpointAddress & 0x80) != LIBUSB_ENDPOINT_IN) { + if((intf->endpoint[0].bEndpointAddress & 0x80) == LIBUSB_ENDPOINT_OUT && + (intf->endpoint[1].bEndpointAddress & 0x80) == LIBUSB_ENDPOINT_IN) { + usbdev->interface = intf->bInterfaceNumber; + usbdev->ep_out = intf->endpoint[0].bEndpointAddress; + usbdev->ep_in = intf->endpoint[1].bEndpointAddress; + usbmuxd_log(LL_INFO, "Found interface %d with endpoints %02x/%02x for device %d-%d", usbdev->interface, usbdev->ep_out, usbdev->ep_in, bus, address); + break; + } else if((intf->endpoint[1].bEndpointAddress & 0x80) == LIBUSB_ENDPOINT_OUT && + (intf->endpoint[0].bEndpointAddress & 0x80) == LIBUSB_ENDPOINT_IN) { + usbdev->interface = intf->bInterfaceNumber; + usbdev->ep_out = intf->endpoint[1].bEndpointAddress; + usbdev->ep_in = intf->endpoint[0].bEndpointAddress; + usbmuxd_log(LL_INFO, "Found interface %d with swapped endpoints %02x/%02x for device %d-%d", usbdev->interface, usbdev->ep_out, usbdev->ep_in, bus, address); + break; + } else { usbmuxd_log(LL_WARNING, "Endpoint type mismatch for interface %d of device %d-%d", intf->bInterfaceNumber, bus, address); - continue; } - usbdev->interface = intf->bInterfaceNumber; - usbdev->ep_out = intf->endpoint[0].bEndpointAddress; - usbdev->ep_in = intf->endpoint[1].bEndpointAddress; - usbmuxd_log(LL_INFO, "Found interface %d with endpoints %02x/%02x for device %d-%d", usbdev->interface, usbdev->ep_out, usbdev->ep_in, bus, address); - break; } libusb_free_config_descriptor(config); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/daemon/usb.h new/usbmuxd-1.0.7/daemon/usb.h --- old/usbmuxd-1.0.6/daemon/usb.h 2010-09-28 03:32:44.000000000 +0200 +++ new/usbmuxd-1.0.7/daemon/usb.h 2011-03-15 12:35:15.000000000 +0100 @@ -46,7 +46,7 @@ #define VID_APPLE 0x5ac #define PID_RANGE_LOW 0x1290 -#define PID_RANGE_MAX 0x129f +#define PID_RANGE_MAX 0x12af struct usb_device; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/libusbmuxd/CMakeLists.txt new/usbmuxd-1.0.7/libusbmuxd/CMakeLists.txt --- old/usbmuxd-1.0.6/libusbmuxd/CMakeLists.txt 2010-09-28 03:32:44.000000000 +0200 +++ new/usbmuxd-1.0.7/libusbmuxd/CMakeLists.txt 2011-03-15 12:35:15.000000000 +0100 @@ -1,6 +1,15 @@ include_directories (${CMAKE_SOURCE_DIR}/common) find_package(Threads) +option(WANT_INOTIFY "Build with inotify support" ON) +if (WANT_INOTIFY) +find_package(Inotify) +if (INOTIFY_FOUND) + add_definitions("-DHAVE_INOTIFY") + message("-- libusbmuxd will be built with inotify support") +endif() +endif(WANT_INOTIFY) + add_library (libusbmuxd SHARED libusbmuxd.c sock_stuff.c ${CMAKE_SOURCE_DIR}/common/utils.c) find_library (PTHREAD pthread) @@ -24,6 +33,9 @@ if(APPLE) set_target_properties(libusbmuxd PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") endif() +if(WIN32) + set_target_properties(libusbmuxd PROPERTIES PREFIX "lib" IMPORT_PREFIX "lib") +endif() install(TARGETS libusbmuxd RUNTIME DESTINATION bin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/libusbmuxd/libusbmuxd.c new/usbmuxd-1.0.7/libusbmuxd/libusbmuxd.c --- old/usbmuxd-1.0.6/libusbmuxd/libusbmuxd.c 2010-09-28 03:32:44.000000000 +0200 +++ new/usbmuxd-1.0.7/libusbmuxd/libusbmuxd.c 2011-03-15 12:35:15.000000000 +0100 @@ -30,13 +30,24 @@ #include <windows.h> #include <winsock2.h> #define sleep(x) Sleep(x*1000) +#define EPROTO 71 +#define EBADMSG 77 #else #include <sys/socket.h> #include <arpa/inet.h> +#include <pthread.h> #endif + +#ifdef HAVE_INOTIFY +#include <sys/inotify.h> +#define EVENT_SIZE (sizeof (struct inotify_event)) +#define EVENT_BUF_LEN (1024 * (EVENT_SIZE + 16)) +#define USBMUXD_DIRNAME "/var/run" +#define USBMUXD_SOCKET_NAME "usbmuxd" +#endif /* HAVE_INOTIFY */ + #include <unistd.h> #include <signal.h> -#include <pthread.h> #ifdef HAVE_PLIST #include <plist/plist.h> @@ -56,7 +67,11 @@ static struct collection devices; static usbmuxd_event_cb_t event_cb = NULL; +#ifdef WIN32 +HANDLE devmon = NULL; +#else pthread_t devmon; +#endif static int listenfd = -1; static int use_tag = 0; @@ -374,19 +389,10 @@ callback(&ev, user_data); } -/** - * Tries to connect to usbmuxd and wait if it is not running. - * - * TODO inotify support should come here - */ -static int usbmuxd_listen() +static int usbmuxd_listen_poll() { int sfd; - uint32_t res = -1; -#ifdef HAVE_PLIST -retry: -#endif sfd = connect_usbmuxd_socket(); if (sfd < 0) { while (event_cb) { @@ -397,6 +403,86 @@ } } + return sfd; +} + +#ifdef HAVE_INOTIFY +static int usbmuxd_listen_inotify() +{ + int inot_fd; + int watch_fd; + int sfd; + + sfd = connect_usbmuxd_socket(); + if (sfd >= 0) + return sfd; + + sfd = -1; + inot_fd = inotify_init (); + if (inot_fd < 0) { + fprintf (stderr, "Failed to setup inotify\n"); + return -1; + } + + /* inotify is setup, listen for events that concern us */ + watch_fd = inotify_add_watch (inot_fd, USBMUXD_DIRNAME, IN_CREATE); + if (watch_fd < 0) { + fprintf (stderr, "Failed to setup watch for socket dir\n"); + close (inot_fd); + return -1; + } + + while (1) { + ssize_t len, i; + char buff[EVENT_BUF_LEN] = {0}; + + i = 0; + len = read (inot_fd, buff, EVENT_BUF_LEN -1); + if (len < 0) + goto end; + while (i < len) { + struct inotify_event *pevent = (struct inotify_event *) & buff[i]; + + /* check that it's ours */ + if (pevent->mask & IN_CREATE && + pevent->len && + pevent->name != NULL && + strcmp(pevent->name, USBMUXD_SOCKET_NAME) == 0) { + sfd = connect_usbmuxd_socket (); + goto end; + } + i += EVENT_SIZE + pevent->len; + } + } + +end: + close(watch_fd); + close(inot_fd); + + return sfd; +} +#endif /* HAVE_INOTIFY */ + +/** + * Tries to connect to usbmuxd and wait if it is not running. + */ +static int usbmuxd_listen() +{ + int sfd; + uint32_t res = -1; + +#ifdef HAVE_PLIST +retry: +#endif + +#ifdef HAVE_INOTIFY + sfd = usbmuxd_listen_inotify(); + if (sfd < 0) + sfd = usbmuxd_listen_poll(); +#else + sfd = usbmuxd_listen_poll(); +#endif + if (sfd < 0) { fprintf(stderr, "%s: ERROR: usbmuxd was supposed to be running here...\n", __func__); return sfd; @@ -525,7 +611,15 @@ } event_cb = callback; +#ifdef WIN32 + res = 0; + devmon = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)device_monitor, user_data, 0, NULL); + if (devmon == NULL) { + res = GetLastError(); + } +#else res = pthread_create(&devmon, NULL, device_monitor, user_data); +#endif if (res != 0) { fprintf(stderr, "%s: ERROR: Could not start device watcher thread!\n", __func__); return res; @@ -537,12 +631,20 @@ { event_cb = NULL; +#ifdef WIN32 + if (devmon != NULL) { + close_socket(listenfd); + listenfd = -1; + WaitForSingleObject(devmon, INFINITE); + } +#else if (pthread_kill(devmon, 0) == 0) { close_socket(listenfd); listenfd = -1; pthread_kill(devmon, SIGINT); pthread_join(devmon, NULL); } +#endif return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/tools/iproxy.c new/usbmuxd-1.0.7/tools/iproxy.c --- old/usbmuxd-1.0.6/tools/iproxy.c 2010-09-28 03:32:44.000000000 +0200 +++ new/usbmuxd-1.0.7/tools/iproxy.c 2011-03-15 12:35:15.000000000 +0100 @@ -40,9 +40,9 @@ #include <sys/socket.h> #include <sys/un.h> #include <arpa/inet.h> -#endif #include <pthread.h> #include <netinet/in.h> +#endif #include "sock_stuff.h" #include "usbmuxd.h" @@ -105,12 +105,20 @@ int recv_len; int sent; char buffer[131072]; +#ifdef WIN32 + HANDLE stoc = NULL; +#else pthread_t stoc; +#endif printf("%s: fd = %d\n", __func__, cdata->fd); cdata->stop_stoc = 0; +#ifdef WIN32 + stoc = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)run_stoc_loop, cdata, 0, NULL); +#else pthread_create(&stoc, NULL, run_stoc_loop, cdata); +#endif while (!cdata->stop_ctos && cdata->fd>0 && cdata->sfd>0) { recv_len = recv_buf_timeout(cdata->fd, buffer, sizeof(buffer), 0, 5000); @@ -143,7 +151,11 @@ cdata->fd = -1; cdata->stop_stoc = 1; +#ifdef WIN32 + WaitForSingleObject(stoc, INFINITE); +#else pthread_join(stoc, NULL); +#endif return NULL; } @@ -152,7 +164,11 @@ { struct client_data *cdata; usbmuxd_device_info_t *dev_list = NULL; +#ifdef WIN32 + HANDLE ctos = NULL; +#else pthread_t ctos; +#endif int count; if (!arg) { @@ -184,8 +200,13 @@ fprintf(stderr, "Error connecting to device!\n"); } else { cdata->stop_ctos = 0; +#ifdef WIN32 + ctos = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)run_ctos_loop, cdata, 0, NULL); + WaitForSingleObject(ctos, INFINITE); +#else pthread_create(&ctos, NULL, run_ctos_loop, cdata); pthread_join(ctos, NULL); +#endif } if (cdata->fd > 0) { @@ -226,7 +247,11 @@ fprintf(stderr, "Error creating socket: %s\n", strerror(errno)); return -errno; } else { +#ifdef WIN32 + HANDLE acceptor = NULL; +#else pthread_t acceptor; +#endif struct sockaddr_in c_addr; socklen_t len = sizeof(struct sockaddr_in); struct client_data cdata; @@ -237,8 +262,13 @@ if (c_sock) { printf("accepted connection, fd = %d\n", c_sock); cdata.fd = c_sock; +#ifdef WIN32 + acceptor = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)acceptor_thread, &cdata, 0, NULL); + WaitForSingleObject(acceptor, INFINITE); +#else pthread_create(&acceptor, NULL, acceptor_thread, &cdata); pthread_join(acceptor, NULL); +#endif } else { break; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/udev/85-usbmuxd.rules.in new/usbmuxd-1.0.7/udev/85-usbmuxd.rules.in --- old/usbmuxd-1.0.6/udev/85-usbmuxd.rules.in 2010-09-28 03:32:44.000000000 +0200 +++ new/usbmuxd-1.0.7/udev/85-usbmuxd.rules.in 2011-03-15 12:35:15.000000000 +0100 @@ -1,7 +1,7 @@ # 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", ATTR{idVendor}=="05ac", ATTR{idProduct}=="129[0-9a-f]", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}!="$attr{bNumConfigurations}", ATTR{bConfigurationValue}="$attr{bNumConfigurations}", RUN+="@CMAKE_INSTALL_PREFIX@/sbin/usbmuxd -u -U usbmux" +# Forces iDevices to the last USB configuration and runs usbmuxd +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="12[9a][0-9a-f]", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}!="$attr{bNumConfigurations}", ATTR{bConfigurationValue}="$attr{bNumConfigurations}", RUN+="@CMAKE_INSTALL_PREFIX@/sbin/usbmuxd -u -U usbmux" # Exit usbmuxd when the last device is removed -ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/129[0-9a-f]/*", ENV{INTERFACE}=="255/*", RUN+="@CMAKE_INSTALL_PREFIX@/sbin/usbmuxd -x" +ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ENV{INTERFACE}=="255/*", RUN+="@CMAKE_INSTALL_PREFIX@/sbin/usbmuxd -x" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usbmuxd-1.0.6/version.tag new/usbmuxd-1.0.7/version.tag --- old/usbmuxd-1.0.6/version.tag 2010-10-24 14:49:27.000000000 +0200 +++ new/usbmuxd-1.0.7/version.tag 2011-03-22 10:12:35.000000000 +0100 @@ -1 +1 @@ -1.0.6 +1.0.7 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de