[Moto G Q&A, Help & Troubleshooting] nlra:
You should read some of the other threads on how to unlock your Moto G bootloader and how to flash stock ROMs back, at the very least, before applying mine. I can't educate you on these matters here and there are other threads more appropriate for those discussions. Then take that knowledge and apply it to this. In this case, as long as you are using a stock Motorola ROM already (and not a GPE ROM!), you only need to flash one component: the kernel.

This kernel is completely identical to the stock Motorola kernel in every way except that it has ziddey's patch applied. So the only downsides would be:

1) because you have to unlock the bootloader, if you live in the U.S. at least, Motorola can legally void your hardware warranty, even if you have a hardware failure that cannot be linked to your unlocking of the bootloader. (Other countries' laws are different and Motorola may not be legally allowed to void warranties for bootloader unlocks where you are at.)

2) If an OTA update is pushed to your phone, I believe the kernel will be replaced with a stock one again, and this will stop working. Either that, or because you are running a custom kernel or an unlocked bootloader, perhaps OTAs won't be pushed to your phone, or if they are, they might not install. I have not tested this or read up on this myself as I generally detest OTA updates outside of my control, and prefer to flash my devices myself on my terms when I'm ready to do so.

You can read about ziddey's USB OTG patches that he developed (with the help/inspiration of CaptainMuon) here: http://xdaforums.com/nexus-4/orig-development/usb-otg-externally-powered-usb-otg-t2181820

The only real difference between how this works on the Nexus 4 and how this works on the Moto G is that, as I explained previously, on the Moto G, there is something in hardware that prevents the phone from accepting a charge if it detects that you are using an OTG micro-USB cable, whereas the Nexus 4 doesn't care if you use an OTG cable or not because pin 5 on the Nexus 4 is not actually wired to anything internally. On the Moto G, there is even a slight cosmetic quirk: if you try to inject 5V power to the phone through an OTG cable, the first time that you plug it in after a fresh reboot, it will say that it is charging after you plug the cable in, but it actually isn't (battery will continue to deplete). And if you unplug the cable and plug it back in, it will no longer show the "charging" symbol, until you reboot the phone again. If you plug in a regular micro-USB cable, though, it will both show charging as well as actually take a charge.

Another thing to be aware of is that there are two different releases of KitKat 4.4.2 that Motorola has released for the G (they released an updated 4.4.2 ROM that fixed a couple of bugs after its initial release), but as far as I can tell, they have so far only released the kernel sources for the original 4.4.2 ROM and not the updated one. So I have only managed to build a kernel for the original 4.4.2 update for the Moto G. I have not tested this, but it's *possible* that this kernel will work just fine with the later 4.4.2 ROM. You are welcome to try it; you won't harm your phone by doing so and can always flash the factory kernel back if it doesn't work or has problems. This kernel likely won't work with any 3rd-party ROMs or with the Google Play Edition ROM (which doesn't support USB DACs anyway, sooo no point in using that one, at least if you care about USB audio which you obviously do). Motorola has not released any kernel sources for 4.4.3 or 4.4.4 yet either, so you should stick with 4.4.2 for now. If this kernel does not work with the later 4.4.2 release, then you should be able to downgrade your system image to the older 4.4.2 ROM and use this kernel with that.

The two 4.4.2 releases on the Moto G (excluding the GPE ROM) are marked by their kernel versions. The first 4.4.2 kernel is versioned as KXB20.9-1.8-1.4, and corresponds to the U.S. retail 172.44.4 ROM version, among others internationally. The second 4.4.2 kernel is versioned as KXB20.9-1.10-1.24-1.1, and corresponds to the U.S. retail 174.44.1 ROM version, among others internationally. It is the source for the first kernel that I have access to.

You may download my kernel from here: http://www.nconx.com/~nathan/motog/boot_motog_KXB20.9-1.8-1.4_OTG_charge.img

After you have unlocked the bootloader via Motorola's site and mfastboot, enter Fastboot mode on your phone again, and then flash the kernel to the phone with mfastboot (the Motorola version of fastboot) the same way that you would flash a stock Motorola kernel (see this post, step 3b: http://xdaforums.com/showthread.php?t=2542219), but substituting in the file name of my kernel instead:

mfastboot flash boot boot_motog_KXB20.9-1.8-1.4_OTG_charge.img

Reboot your phone, plug it into your DAC + 5V power source (again, using a normal micro-USB cable), and enjoy battery charging while simultaneously connected up to your external DAC. :)

Good luck,

-- Nathan