mkorenkov / ipad_charge

charge Apple devices under Ubuntu Linux
GNU General Public License v2.0
259 stars 72 forks source link

Chage HP Touchpad #27

Open deerewright opened 11 years ago

deerewright commented 11 years ago

This works great to charge my ipad (4th gen.) I would like to modify this to also charge my HP Touchpad. Here is my lsusb output for the Touchpad:

"Bus 002 Device 008: ID 0830:8072 Palm, Inc."

I tried adding to "95-ipad_charge.rules" the following:

ENV{DEVTYPE}=="usb_device", ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0830", ATTR{idProduct}=="8072", RUN+="/usr/bin/ipad_charge"

but, I keep getting the following error:

ipad_charge: no such device or an error occured

Any ideas? Any other information I need to make this work?

here is lsusb -v output:

Bus 002 Device 008: ID 0830:8072 Palm, Inc. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0830 Palm, Inc. idProduct 0x8072 bcdDevice 3.27 iManufacturer 1 HP iProduct 2 webOS-device iSerial 3 0123456789ABCDEF bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 55 bNumInterfaces 2 bConfigurationValue 2 iConfiguration 4 ums+novcom bmAttributes 0xc0 Self Powered MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 1 HP Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 71 bInterfaceProtocol 17 iInterface 5 Novacom Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0000 (Bus Powered)

I should also mention I am running on Ubuntu 12.10 64bit, and I installed this with a deb from here: http://www.yourproblemsolved.com/sites/default/files/ipad-charge-1.0_20101231-1_amd64.deb.zip

I'm assuming I'd have to edit ipad_charge.c and build from source?

pmadhyastha commented 11 years ago

True, you would have to modify "ipad_charge.c" too.

affix commented 11 years ago

Keep in mind this was developed for iPad / iPhone / iPod Touch

So this might not charge your HP Touchpad. Please note that if you do make any changes and there is any damage to the device none of the contributing developers will accept responsibility for it.

deerewright commented 11 years ago

"Keep in mind this was developed for iPad / iPhone / iPod Touch

So this might not charge your HP Touchpad. Please note that if you do make any changes and there is any damage to the device none of the contributing developers will accept responsibility for it."

Completely understood. I do know that the output of both the ipad charger and the HP charger is the same.

I'm not a complete noob, but I know just enough linux to be dangerous :)

"True, you would have to modify "ipad_charge.c" too."

what and how do I modify?

affix commented 11 years ago

You would need to define the new vendor as VENDOR_HP

And the device as DEVICE_HP_TOUCHPAD

#define VENDOR_HP 0x0830
#define DEVICE_HP_TOUCHPAD 0x8072

Add a new IF statement to line 168

else if(desc.idVendor == VENDOR_HP && (desc.idProduct == DEVICE_HP_TOUCHPAD))
{
            if (set_charging_mode(dev, enable) < 0)
                        fprintf(stderr, "ipad_charge: error setting charge mode\n");
            else
                        count++;
}

Let me know if it works out for you

deerewright commented 11 years ago

I edited my original post with more info, but I did install via .deb file. I assume, after the edits, I need to "make" and and "make install"? Should I uninstall my deb first?

affix commented 11 years ago

Yes remove the deb package first. Once you make the edits you would need to rebuild from source.

deerewright commented 11 years ago

No luck,

still same error

I added to line 168, after "}" and this is what it looks like:

"if (desc.idVendor == VENDOR_APPLE && (desc.idProduct == PRODUCT_IPAD1 || desc.idProduct == PRODUCT_IPAD2 || desc.idProduct == PRODUCT_IPAD2_3G || desc.idProduct == PRODUCT_IPAD2_4 || desc.idProduct == PRODUCT_IPAD2_3GV || desc.idProduct == PRODUCT_IPAD3 || desc.idProduct == PRODUCT_IPAD3_4G || desc.idProduct == PRODUCT_IPOD_TOUCH_2G || desc.idProduct == PRODUCT_IPHONE_3GS || desc.idProduct == PRODUCT_IPHONE_4_GSM || 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 || desc.idProduct == PRODUCT_IPAD4)) {

            if (set_charging_mode(dev, enable) < 0)
                fprintf(stderr, "ipad_charge: error setting charge mode\n");
            else
                count++;
        }else if(desc.idVendor == VENDOR_APPLE && (desc.idProduct == DEVICE_HP_TOUCHPAD))

{ if (set_charging_mode(dev, enable) < 0) fprintf(stderr, "ipad_charge: error setting charge mode\n"); else count++; } } }

Did I get it in the right place? Also I put the DEFINE statements just after all the others:

define VERSION "1.1"

define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT)

define VENDOR_APPLE 0x05ac

define PRODUCT_IPAD1 0x129a

define PRODUCT_IPAD2 0x129f

define PRODUCT_IPAD2_3G 0x12a2

define PRODUCT_IPAD2_4 0x12a9

define PRODUCT_IPAD2_3GV 0x12a3

define PRODUCT_IPAD3 0x12a4

define PRODUCT_IPAD3_4G 0x12a6

define PRODUCT_IPAD4 0x12ab

define PRODUCT_IPOD_TOUCH_2G 0x1293

define PRODUCT_IPHONE_3GS 0x1294

define PRODUCT_IPHONE_4_GSM 0x1297

define PRODUCT_IPOD_TOUCH_3G 0x1299

define PRODUCT_IPHONE_4_CDMA 0x129c

define PRODUCT_IPOD_TOUCH_4G 0x129e

define PRODUCT_IPHONE_4S 0x12a0

define PRODUCT_IPHONE_5 0x12a8

define VENDOR_HP 0x0830

define DEVICE_HP_TOUCHPAD 0x8072

Does the order matter?

affix commented 11 years ago

yes you put it in the right place.

There could be a different charging mechanism in place for the HP Touchpad when connecting it to a PC or Laptop.

deerewright commented 11 years ago

Well I tried starting all over using the directions in the wiki for package install "checkinstall", still no luck, I get three messages now:

ipad_charge: unable to claim interface: error -6 ipad_charge: error setting charge mode ipad_charge: no such device or an error occured

Thanks for the help anyway. It was a good instructional, for me, at least.....

deerewright commented 11 years ago

Must be....I just tried it on same laptop in windows with asus ai charger. Works with ipad not Touchpad

There could be a different charging mechanism in place for the HP Touchpad when connecting it to a PC or Laptop.

wanderdeng commented 9 years ago

Thank you! I am so happy you will reply me.I try to add other devices ID(s) or set BUSNUM && DEVNUM, still no luck,result the same error: (in func “libusb_claim_interface”)

htc_charge: unable to claim interface: error -6 htc_charge: error setting charge mode htc_charge: no such device or an error occured

Thanks for the help anyway. It was a good instructional, for me,so.