Today, I found that the ipad always displays NotCharging on Ubuntu. I searched for it and found someone wrote an ipad_charge program: notebook. So I transplanted it with pyusb (apt-getinstallpython-usb :#! /Usr/bin/pythonimport
Today I found that the ipad on Ubuntu will always show Not Charging, searched, found someone wrote an ipad_charge program: https://github.com/mkorenkov/ipad_charge/
After reading the source code, you can send a control command to start and stop charging.
So we transplanted it with pyusb (apt-get install python-usb:
#!/usr/bin/python
import usb.core
import usb.util
import usb.backend.libusb10
import sys, getopt
opts = getopt.getopt(sys.argv[1:],'',['off'])
off = 'off' in opts[1]
VENDOR_APPLE = 0x05ac
PRODUCT_IPAD1 = 0x129a
PRODUCT_IPAD2 = 0x129f
# find our device
dev = usb.core.find(idVendor=VENDOR_APPLE, idProduct=PRODUCT_IPAD1)
if not dev:
dev = usb.core.find(idVendor=VENDOR_APPLE, idProduct=PRODUCT_IPAD2)
if dev is None:
raise ValueError('Device not found')
usb.util.claim_interface(dev, 0)
dev.ctrl_transfer(usb.util.CTRL_TYPE_VENDOR|usb.util.CTRL_OUT, 0x40, 0x6400, 0x6400 if not off else 0, None, 2000)
usb.util.release_interface(dev, 0)
Charging:
Python ipad_charge.py
Stop charging:
Python ipad_charge.py off