5

There's been news that Linux 5.7 supports configuring "USB Fast Charge Support For Apple iOS Devices". Now that Arch Linux is shipping 5.7 and I have upgraded to it, I decided that I would like to try it out. However, the most information that I could find was

The apple-mfi-fastcharge driver will allow setting the power supply property via sysfs to "fast"

which doesn't describe how to actually configure the feature. How can I enable it?

lights0123
  • 311
  • 3
  • 7

1 Answers1

6

When the apple-mfi-fastcharge driver is compiled into the kernel, as it is in Arch Linux, it will automatically be loaded when plugging in an iPhone. This may be verified by running sudo dmesg -w and verifying that the following message appears:

usbcore: registered new device driver apple-mfi-fastcharge

(note: this will only happen once per boot. Run sudo dmesg | grep apple-mfi-fastcharge to see if it has been loaded at all in the past)

Now, you may tell the driver to enable fast charging:

sudo tee /sys/class/power_supply/apple_mfi_fastcharge/charge_type <<< Fast

You will need to do this every time the device is unplugged and plugged back in. To avoid that, you may create a udev rule by creating the file /etc/udev/rules.d/99-iphone-fastcharge.rules with the following contents:

SUBSYSTEM=="usb", ACTION=="add", ENV{ID_MODEL}=="iPhone", RUN+="/usr/bin/env sh -c 'echo Fast > /sys/class/power_supply/apple_mfi_fastcharge/charge_type'"
lights0123
  • 311
  • 3
  • 7
  • If you want to fast charge an iPad, you can use `ENV{ID_MODEL}=="iPad"` to trigger the script. – Dan Monego Apr 24 '21 at 16:24
  • Instead of matching on the model, it might make more sense to match on the driver (`DRIVER=="apple-mfi-fastcharge"`) or the power supply device (`SUBSYSTEM=="power_supply", ACTION=="add", ENV{POWER_SUPPLY_NAME}="apple_mfi_fastcharge"`). In fact, just set fast on *any* power supply device like https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/blob/main/src/ppd-action-trickle-charge.c. – Mingye Wang Jun 08 '23 at 06:46
  • So uh I played around the stuff a bit and it turns out on my udev it insists on a "change" event instead. The definition therefore changes to `SUBSYSTEM=="power_supply", ACTION=="change", RUN+="/bin/sh -c 'echo Fast > %S%p/charge_type || :'"`. (The `|| :` is there to prevent spamming the log with errors on removal.) – Mingye Wang Jun 08 '23 at 09:11