View Single Post
Old 10-11-2020, 06:03 PM   #1
katadelos
rm -rf /
katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.
 
Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
Kindle USB OTG Control for iMX6

What is it?
This is a kernel module that allows you to enable and disable USB OTG functionality on Kindle devices using the iMX6 SOC. This functionality is disabled on most iMX6 devices by default; the only working devices are USB sound cards on the PW3 and later devices.

This module is capable of expanding that support to any USB device supported by the 3.0.35-lab126 kernel (as long as the additional kernel modules required by the device are compiled and loaded into the kernel too).

It has been tested on the KT2 and PW3, but will likely work on the KOA, PW2 and KV too.

How do I use it?
First, insert the module into the kernel:
Code:
insmod otg_control.ko
The module can be removed from the kernel like so:
Code:
rmmod otg_control
The module exposes a procfs entry that allows you to:
  • Enable USB OTG functionality
  • Disable USB OTG functionality
  • Set the audio_enumerated variable to 1
  • Set the audio_enumerated variable to 0
To carry out any of these actions, you will need to write the following values to /proc/usb_otg:
Code:
echo 0 > /proc/usb_otg     # Disable USB OTG functionality
echo 1 > /proc/usb_otg     # Enable USB OTG functionality
echo 2 > /proc/usb_otg     # Set audio_enumerated to 1
echo 3 > /proc/usb_otg     # Set audio_enumerated to 0
On devices that support the Kindle Audio Adapter accessory, you should use the Set audio_enumerated to 1 option - this bypasses the check used by Lab126 to lock out other USB peripherals.

For older devices, use the Enable USB OTG functionality option. This does the same thing as the option above, as well as a couple of additional setup tasks which need to be carried out before USB OTG can be used.

Building from source:
To build this module from source, you will need a cross-compiler toolchain.
Code:
git clone https://github.com/katadelos/linux-3.0.35-lab126.git
cd linux-3.0.35-lab126/
git checkout usb-otg-control 
make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- imx60_wario_defconfig
echo "CONFIG_USB_KINDLE_OTG_CONTROL=m" >> .config 
make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- modules_prepare
make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- M=drivers/usb/otg/
Attached Files
File Type: zip otg_control.zip (2.0 KB, 385 views)
katadelos is offline   Reply With Quote