usbmuxd: initial add-on

This commit is contained in:
Lukas Rusak 2016-12-02 11:25:30 -08:00
parent dfb6325a47
commit 7f739667b0
No known key found for this signature in database
GPG Key ID: 8C310C807E7393A3
6 changed files with 263 additions and 0 deletions

View File

@ -0,0 +1,2 @@
8.1.100
- initial release

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,48 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2016 Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="usbmuxd"
PKG_VERSION="1.1.0"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.libimobiledevice.org"
PKG_URL="http://www.libimobiledevice.org/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2"
PKG_DEPENDS_TARGET="toolchain libusb libimobiledevice"
PKG_SECTION="service"
PKG_SHORTDESC="USB Multiplex Daemon"
PKG_LONGDESC="USB Multiplex Daemon"
PKG_AUTORECONF="no"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="iPhone Tether"
PKG_ADDON_TYPE="xbmc.service"
PKG_DISCLAIMER="Additional data charges may occur. The LibreELEC team doesn't take any resposibility for extra data charges."
PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \
ac_cv_func_realloc_0_nonnull=yes"
makeinstall_target() {
:
}
addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -P $PKG_BUILD/.$TARGET_NAME/src/usbmuxd $ADDON_BUILD/$PKG_ADDON_ID/bin/
}

View File

@ -0,0 +1,184 @@
diff -Naur a/src/utils.c b/src/utils.c
--- a/src/utils.c 2014-10-16 04:23:27.000000000 -0700
+++ b/src/utils.c 2015-11-12 14:41:05.656507596 -0800
@@ -156,149 +156,6 @@
#endif
/**
- * Concatenate strings into a newly allocated string
- *
- * @note: Specify NULL for the last string in the varargs list
- *
- * @str: The first string in the list
- * @...: Subsequent strings. Use NULL for the last item.
- *
- * @return a newly allocated string, or NULL if @str is NULL. This will also
- * return NULL and set errno to ENOMEM if memory is exhausted.
- */
-char *string_concat(const char *str, ...)
-{
- size_t len;
- va_list args;
- char *s;
- char *result;
- char *dest;
-
- if (!str)
- return NULL;
-
- /* Compute final length */
-
- len = strlen(str) + 1; /* plus 1 for the null terminator */
-
- va_start(args, str);
- s = va_arg(args, char *);
- while (s) {
- len += strlen(s);
- s = va_arg(args, char*);
- }
- va_end(args);
-
- /* Concat each string */
-
- result = malloc(len);
- if (!result)
- return NULL; /* errno remains set */
-
- dest = result;
-
- dest = stpcpy(dest, str);
-
- va_start(args, str);
- s = va_arg(args, char *);
- while (s) {
- dest = stpcpy(dest, s);
- s = va_arg(args, char *);
- }
- va_end(args);
-
- return result;
-}
-
-void buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length)
-{
- FILE *f;
- uint64_t size;
-
- *length = 0;
-
- f = fopen(filename, "rb");
- if (!f) {
- return;
- }
-
- fseek(f, 0, SEEK_END);
- size = ftell(f);
- rewind(f);
-
- if (size == 0) {
- fclose(f);
- return;
- }
-
- *buffer = (char*)malloc(sizeof(char)*(size+1));
- if (fread(*buffer, sizeof(char), size, f) != size) {
- usbmuxd_log(LL_ERROR, "%s: ERROR: couldn't read %d bytes from %s", __func__, (int)size, filename);
- }
- fclose(f);
-
- *length = size;
-}
-
-void buffer_write_to_filename(const char *filename, const char *buffer, uint64_t length)
-{
- FILE *f;
-
- f = fopen(filename, "wb");
- if (f) {
- fwrite(buffer, sizeof(char), length, f);
- fclose(f);
- }
-}
-
-int plist_read_from_filename(plist_t *plist, const char *filename)
-{
- char *buffer = NULL;
- uint64_t length;
-
- if (!filename)
- return 0;
-
- buffer_read_from_filename(filename, &buffer, &length);
-
- if (!buffer) {
- return 0;
- }
-
- if ((length > 8) && (memcmp(buffer, "bplist00", 8) == 0)) {
- plist_from_bin(buffer, length, plist);
- } else {
- plist_from_xml(buffer, length, plist);
- }
-
- free(buffer);
-
- return 1;
-}
-
-int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t format)
-{
- char *buffer = NULL;
- uint32_t length;
-
- if (!plist || !filename)
- return 0;
-
- if (format == PLIST_FORMAT_XML)
- plist_to_xml(plist, &buffer, &length);
- else if (format == PLIST_FORMAT_BINARY)
- plist_to_bin(plist, &buffer, &length);
- else
- return 0;
-
- buffer_write_to_filename(filename, buffer, length);
-
- free(buffer);
-
- return 1;
-}
-
-/**
* Get number of milliseconds since the epoch.
*/
uint64_t mstime64(void)
diff -Naur a/src/utils.h b/src/utils.h
--- a/src/utils.h 2014-10-16 04:29:50.000000000 -0700
+++ b/src/utils.h 2015-11-12 14:40:41.990644890 -0800
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <libimobiledevice/utils.h>
+
#ifndef UTILS_H
#define UTILS_H
@@ -73,18 +75,6 @@
#ifndef HAVE_STPCPY
char *stpcpy(char * s1, const char * s2);
#endif
-char *string_concat(const char *str, ...);
-
-void buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length);
-void buffer_write_to_filename(const char *filename, const char *buffer, uint64_t length);
-
-enum plist_format_t {
- PLIST_FORMAT_XML,
- PLIST_FORMAT_BINARY
-};
-
-int plist_read_from_filename(plist_t *plist, const char *filename);
-int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t format);
uint64_t mstime64(void);

View File

@ -0,0 +1,17 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2016 Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

View File

@ -0,0 +1,12 @@
[Unit]
Description=Socket daemon for the usbmux protocol used by Apple devices
[Service]
Type=simple
ExecStartPre=/sbin/modprobe ipheth
ExecStart=/storage/.kodi/addons/service.usbmuxd/bin/usbmuxd --systemd
PIDFile=/var/run/usbmuxd.pid
[Install]
WantedBy=multi-user.target