ubuntu下为IPAD充电 ipad_charge

2012年 25月 05日 21:39
外接充电器总是个麻烦..一天10小时的守着电脑,还要用一个USB口的外置充电器..这不科学... 按苹果的说法 IPAD电池巨大,0.5A的USB满足不了它.. 好吧..好吧 不过好在有个ipad_charge的小软件 恩.. 科学了... 若是WINDOWS用户 可使用 华硕的 ai charger http://event.asus.com/mb/2010/AI_Charger/ 技嘉科技 ON/OFF Charge http://www.gigabyte.com.tw/microsite/185/on-off-charge.htm 微星i-Charger http://www.softpedia.com/get/IPOD-TOOLS/Other-IPOD-tools-Updates/i-Charger.shtml LINUX用户们可以使用 ipad_charge https://github.com/mkorenkov/ipad_charge/ 作者BLOG http://korenkov.info/ipadcharge-util-updated Now it supports iPad 3 among other devices. Full list of supported devices:
  • iPad
  • iPad2
  • iPad3
  • iPod Touch 2G
  • iPod Touch 3G
  • iPod Touch 4G
  • iPhone 3GS
  • iPhone 4
  • iPhone 4S
安装方法
sudo aptitude install libusb-1.0-0 libusb-1.0-0-dev
git clone https://github.com/mkorenkov/ipad_charge.git
cd ./ipad_charge
make
sudo make install

看到国人移植了pyusb 版本 http://www.cnblogs.com/clowwindy/archive/2011/12/28/charge_ipad_in_python.html
#!/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)

tags: