mkorenkov / ipad_charge

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

[error -6] on Ubuntu 16.04 #42

Open botcs opened 8 years ago

botcs commented 8 years ago

Worked well on 14.04 but after upgrading: ipad_charge: unable to claim interface: error -6 ipad_charge: Resource busy ipad_charge: error setting charge mode ipad_charge: no such device or an error occured

I have iPad mini 1

jameslovallo commented 8 years ago

I get the same error on mine with an iPad Air 2. Have you found a workaround?

botcs commented 8 years ago

not yet :\

nitsanw commented 8 years ago

Had the same issue, after some digging around came up with following solution:

       // hacked into set_charging_mode, replace the claim_interface block with this
       // Resource Busy issue is caused because kernel is attached to device, so enable auto detach
        if ((ret = libusb_set_auto_detach_kernel_driver(dev_handle, 1)) < 0) {
                fprintf(stderr, "ipad_charge: set auto detach failed: error %d\n", ret);
                fprintf(stderr, "ipad_charge: %s\n", libusb_strerror(ret));
                return ret;
        }

        // Original code assumes the bInterfaceNumber is always 0, for me it turned out to be 2.
        // You can use lsusb to find out which interface numbers are available
        if ((ret = libusb_claim_interface(dev_handle, 2)) < 0) {
                fprintf(stderr, "ipad_charge: unable to claim interface: error %d\n", ret);
                fprintf(stderr, "ipad_charge: %s\n", libusb_strerror(ret));
                goto out_close;
        }

I am running Ubuntu 16.04 on an MBP 11,1 and charging and iPad4. Seems to work now.

To find the bInterfaceNumber I used lsusb -v which give you much gory detail. Hope this helps

JanUmbhau commented 7 years ago

Hi nitsanw! I'm new to Linux and am having the same problem. Where exactly do I insert and/or create a new file with the content you posted above? I'm a little reluctant to type anything into the Terminal, without verifying beforehand that that's where the code should go :) Thanks in advance!

nitsanw commented 7 years ago

The fix is now on a fork: https://github.com/nitsanw/ipad_charge I need to further test it and I will submit as PR.

JanUmbhau commented 7 years ago

Thanks!

nitsanw commented 7 years ago

@botcs @JanUmbhau WFM :), try the PR and report back

botcs commented 7 years ago

make succesful, but still not WFM.

when iPad mini connected, returns the following: ./ipad_charge ipad_charge: no such device or an error occured

However my iPad charges... a bit nasty, I don't know where could be actually the problem

0ki commented 7 years ago

Thanks, @nitsanw! Your patch worked for me. Here is a compiled version of ipad_charge as patched: http://02.lv/f/2017/01/21/ipad_charge

freeRain19 commented 6 years ago

@0ki , thanks a lot. This file help me.

jeffsturgis commented 6 years ago

Thanks @nitsanw! Patch works great!

Silfalion commented 5 years ago

it worked for me too, thanks a lot!