Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500ma doesn't work, but 1600 and 16000 work #45

Open
CyberShadow opened this issue Oct 29, 2017 · 1 comment
Open

500ma doesn't work, but 1600 and 16000 work #45

CyberShadow opened this issue Oct 29, 2017 · 1 comment

Comments

@CyberShadow
Copy link

  1. This is missing in set_charging_mode:

     if ((ret = libusb_set_configuration(dev_handle, 1)) < 0) {
     	fprintf(stderr, "ipad_charge: unable to set device configuration: error %d\n", ret);
     	fprintf(stderr, "ipad_charge: %s\n", libusb_strerror(ret));
     	return ret;
     }
    

    ipad_charge needs to set the configuration, as otherwise libusb_claim_interface fails with error -5 (not found), because (AIUI) an unconfigured device has no interfaces.

  2. The 500ma value for libusb_control_transfer didn't work for the charging port on my Sony Vaio SVS15123CXB (it would only show the charging icon for a split-second then revert to "not charging"), but upping it to 1600 worked. 16000 also worked.

@Tatsh
Copy link
Contributor

Tatsh commented Jan 18, 2018

Without configuration, your device should be delivering 500 mA. This is the safest value for USB 2 ports, and the safest value to avoid damaging the (USB 2.0) device.

We should only be defaulting to 2 W/500 mA because although iPads need more, the standard on USB 2.0 only covers 2 W/500 mA. USB 3 makes it 900 mA, which could account for the iPad Pro but I don't believe this is enough.

Anything above 12 W should be considered out of scope because Apple does not sell such adapters. My pull request #48 allows setting an AMPS environment variable to adjust the current after the first 500 mA, up to a total of 2400 mA which is what the majority of USB charges max out at.

There's a reason a warranty can never be provided for this code. Every system is different and most systems nowadays will tolerate the higher current while others will fail (especially older systems). Some will try and then fail (accepting stupidly high values), which may damage the USB ports or at least force you to de-charge the capacitors completely (usually by shutting off and unplugging for about 30 seconds). This could also damage the device and you may not know it until you try to turn it on again. This is probably the reason Apple doesn't really support charging the iPad with non-Macs, and sometimes iPads will not charge on a Mac either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants