From c78164640d5851072671885838d82087829537b5 Mon Sep 17 00:00:00 2001 From: Aron Xu Date: Tue, 19 Dec 2017 10:30:25 +0800 Subject: [PATCH 1/5] Add debian packaging --- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 14 ++++++++++++++ debian/copyright | 29 +++++++++++++++++++++++++++++ debian/docs | 1 + debian/install | 2 ++ debian/rules | 12 ++++++++++++ debian/source/format | 1 + 8 files changed, 65 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/install create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..4f37bd6 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +ipad-charge (20160928-1) unstable; urgency=medium + + * Initial packaging + + -- Aron Xu Tue, 03 Oct 2017 23:26:29 +0800 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..bc34c4b --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: ipad-charge +Section: utils +Priority: optional +Maintainer: Aron Xu +Build-Depends: debhelper (>= 10), libusb-1.0-0-dev +Standards-Version: 4.1.2 +Homepage: https://github.com/mkorenkov/ipad_charge + +Package: ipad-charge +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Apple device charger utility + USB charging control utility used to enable/disable charging of an Apple + device connected to USB port. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..c43aadf --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ipad_charge +Source: https://github.com/mkorenkov/ipad_charge + +Files: * +Copyright: 2011-2016, Max Korenkov and other contributors +License: GPL-2 + +Files: debian/* +Copyright: 2017, Aron Xu +License: GPL-2 + +License: GPL-2 + This program 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. + . + This program 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 this program; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA. + . + On Debian systems, the full text of GPL-2 could be found at + `/usr/share/common-licenses/GPL-2'. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..a959dab --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +ipad_charge usr/bin/ +95-ipad_charge.rules lib/udev/rules.d/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..74e85b0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +#export DH_VERBOSE = 1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ + +override_dh_auto_build: + ${CC} ${CPPFLAGS} ${CFLAGS} ipad_charge.c -lusb-1.0 -o ipad_charge + +override_dh_auto_install: diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) From eb0a515672d5b55e4ba48812ee0578d58a78d568 Mon Sep 17 00:00:00 2001 From: Aron Xu Date: Sun, 8 Jul 2018 22:45:41 +0800 Subject: [PATCH 2/5] Use systemd for udev trigger --- debian/95-ipad_charge.rules | 3 +++ debian/install | 3 ++- debian/ipad-charge.service | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 debian/95-ipad_charge.rules create mode 100644 debian/ipad-charge.service diff --git a/debian/95-ipad_charge.rules b/debian/95-ipad_charge.rules new file mode 100644 index 0000000..2061631 --- /dev/null +++ b/debian/95-ipad_charge.rules @@ -0,0 +1,3 @@ +ENV{DEVTYPE}=="usb_device", ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="129[0-9abcef]", RUN+="/bin/systemctl restart --no-block ipad-charge.service" +ENV{DEVTYPE}=="usb_device", ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="12a[0-9ab]", RUN+="/bin/systemctl restart --no-block ipad-charge.service" +ENV{DEVTYPE}=="usb_device", ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0fca", ATTR{idProduct}=="8014", RUN+="/bin/systemctl restart --no-block ipad-charge.service" diff --git a/debian/install b/debian/install index a959dab..abccdb0 100644 --- a/debian/install +++ b/debian/install @@ -1,2 +1,3 @@ ipad_charge usr/bin/ -95-ipad_charge.rules lib/udev/rules.d/ +debian/95-ipad_charge.rules lib/udev/rules.d/ +debian/ipad-charge.service lib/systemd/system/ diff --git a/debian/ipad-charge.service b/debian/ipad-charge.service new file mode 100644 index 0000000..f58de8f --- /dev/null +++ b/debian/ipad-charge.service @@ -0,0 +1,11 @@ +[Unit] +Description=Apply ipad-charge to devices + +[Service] +Type=oneshot +ExecStartPre=-/bin/sleep 2 +ExecStart=-/usr/bin/ipad_charge +NonBlocking=true + +[Install] +WantedBy=multi-user.target From 135fbada12e4e157c485b2258ce584f7cb11cb78 Mon Sep 17 00:00:00 2001 From: Aron Xu Date: Sun, 8 Jul 2018 22:46:05 +0800 Subject: [PATCH 3/5] debian: use native format --- debian/changelog | 2 +- debian/source/format | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4f37bd6..cf47bd6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ipad-charge (20160928-1) unstable; urgency=medium +ipad-charge (20160928) unstable; urgency=medium * Initial packaging diff --git a/debian/source/format b/debian/source/format index 163aaf8..89ae9db 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) From 1a01322677d206c74c32d2f6da0ea26b7e3f3f99 Mon Sep 17 00:00:00 2001 From: Aron Xu Date: Sun, 8 Jul 2018 23:09:03 +0800 Subject: [PATCH 4/5] Give 1600 mA for iPhone 5/5S/6/6S --- ipad_charge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipad_charge.c b/ipad_charge.c index ebb0244..46749e2 100644 --- a/ipad_charge.c +++ b/ipad_charge.c @@ -168,7 +168,8 @@ int main(int argc, char *argv[]) { || desc.idProduct == PRODUCT_IPAD2_3GV || desc.idProduct == PRODUCT_IPAD3 || desc.idProduct == PRODUCT_IPAD3_4G - || desc.idProduct == PRODUCT_IPAD4_AIR_AIR2_MINI)) { + || desc.idProduct == PRODUCT_IPAD4_AIR_AIR2_MINI + || desc.idProduct == PRODUCT_IPHONE_5_5S_6)) { if (set_charging_mode(dev, enable, ADDITIONAL_VALUE_IPAD) < 0) fprintf(stderr, "ipad_charge: error setting charge mode\n"); @@ -181,8 +182,7 @@ int main(int argc, char *argv[]) { || desc.idProduct == PRODUCT_IPOD_TOUCH_3G || desc.idProduct == PRODUCT_IPHONE_4_CDMA || desc.idProduct == PRODUCT_IPOD_TOUCH_4G - || desc.idProduct == PRODUCT_IPHONE_4S - || desc.idProduct == PRODUCT_IPHONE_5_5S_6)) { + || desc.idProduct == PRODUCT_IPHONE_4S)) { if (set_charging_mode(dev, enable, ADDITIONAL_VALUE_IPHONE) < 0) fprintf(stderr, "ipad_charge: error setting charge mode\n"); From 1b9d24b533792ae1858d729d523a056f1ee2c3ca Mon Sep 17 00:00:00 2001 From: Aron Xu Date: Sun, 8 Jul 2018 23:10:31 +0800 Subject: [PATCH 5/5] Bump changelog --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index cf47bd6..a2e150f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ipad-charge (20160928) unstable; urgency=medium +ipad-charge (20180708) unstable; urgency=medium * Initial packaging