Skip to content

Commit

Permalink
Merge pull request #46 from happyaron/master
Browse files Browse the repository at this point in the history
Add debian packaging
  • Loading branch information
pmadhyastha authored Jan 7, 2021
2 parents a64e369 + 1b9d24b commit f070404
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 3 deletions.
3 changes: 3 additions & 0 deletions debian/95-ipad_charge.rules
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ipad-charge (20180708) unstable; urgency=medium

* Initial packaging

-- Aron Xu <happyaron.xu@gmail.com> Tue, 03 Oct 2017 23:26:29 +0800
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
14 changes: 14 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Source: ipad-charge
Section: utils
Priority: optional
Maintainer: Aron Xu <happyaron.xu@gmail.com>
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.
29 changes: 29 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -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 <mkorenkov@gmail.com> and other contributors
License: GPL-2

Files: debian/*
Copyright: 2017, Aron Xu <happyaron.xu@gmail.com>
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'.
1 change: 1 addition & 0 deletions debian/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
3 changes: 3 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ipad_charge usr/bin/
debian/95-ipad_charge.rules lib/udev/rules.d/
debian/ipad-charge.service lib/systemd/system/
11 changes: 11 additions & 0 deletions debian/ipad-charge.service
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -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:
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
6 changes: 3 additions & 3 deletions ipad_charge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit f070404

Please sign in to comment.