Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-21-2016, 06:36 AM   #1
lucida
Enthusiast
lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.
 
Posts: 29
Karma: 118906
Join Date: Jul 2016
Device: PW3
USB OTG mouse support and page turn on PW3(possible KV/KOA)

Long story short, since a DIY kindle USB audio adapter can be made from a regular USB OTG cable + USB audio adapter, I believe that any kindle supporting the USB audio adapter(PW3 as well as KV KOA) should have OTG compatible hardware.

So I compiled necessary USB mouse modules from PW3 5.8.1 source and wrote a small app to monitor the mouse click and turn page accordingly.

To install, download and extract the content to /mnt/us/extensions, plug in the OTG cable and USB mouse then start from KUAL menu. To stop, remove the OTG cable first then stop from KUAL.

Configuration is in bin/config.sh which detects kindle model automatically. By default, left click/scroll wheel down = next page, right click/wheel up = previous page, middle click = menu(top area)

Other thoughts

Is it possible to add the mouse entry to /etc/xorg.conf? and would be great if someone can build a KUAL extension so it can be installed and run without usbnet.

Supported Devices
Works on my PW3 5.8.1 and 5.8.2.
Also confirmed to work on KV and KOA 5.8.1, 5.8.2 is untested on these two yet.
On KOA battery case must be attached.

Need some test on PW2 and KT2, maybe KT3.
Attached Files
File Type: zip usbotgmouse.zip (63.8 KB, 257 views)

Last edited by lucida; 08-04-2016 at 07:16 PM.
lucida is offline   Reply With Quote
Advert
Old 07-21-2016, 07:02 AM   #2
greentea
Member
greentea began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Nov 2015
Device: PW2, Oasis, DX
It would be great to have wired or even wireless mouse connected to Kindle's micro USB port and turn pages using mouse wheel. A LOT of people around here would love you for that!
greentea is offline   Reply With Quote
Old 07-21-2016, 07:56 AM   #3
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10764860
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by lucida View Post
1. In my kindle, the usb port toggles between host and gadget mode, and, lots of mouse clicks are not registered. My OTG cable has sd card reader, HDMI builtin so I'm not sure if its my cable or the kindle hardware or misconfigured kernel modules. I don't have other OTG cable at hand, so please test and report your result.
Your lost mouse clicks are probably because you now have TWO kernel module drivers competing for the same USB resources. You must 'rmmod' the loaded driver before loading another one that uses the same resources. To see how this is done, see the scripts in the USBnet package which switches between USBnet and USB mass storage (USBMS) gadgets.

Also, be sure to unload (rmmod) your module when done using it so it does not interfere with shared kindle USB drive data transfers (by intercepting USB packets not intended for it).

You need a multiplex driver to support multiple USB devices (or gadgets) simultaneously over a single USB port.
Quote:
Originally Posted by lucida View Post
... and would be great if someone can build a KUAL extension so it can be installed and run without usbnet.
You should be easily able to modify an existing (simple) KUAL extension to support this.

Last edited by geekmaster; 07-21-2016 at 08:56 AM.
geekmaster is offline   Reply With Quote
Old 07-21-2016, 09:24 AM   #4
zxczxc
Addict
zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.
 
Posts: 227
Karma: 136000
Join Date: Apr 2013
Device: PW
This is very very cool!
Thanks for the work and most of all sharing it.
I hope this gets improved, it could be quite slick.
zxczxc is offline   Reply With Quote
Old 07-22-2016, 03:08 AM   #5
lucida
Enthusiast
lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.
 
Posts: 29
Karma: 118906
Join Date: Jul 2016
Device: PW3
Quote:
Originally Posted by geekmaster View Post
Your lost mouse clicks are probably because you now have TWO kernel module drivers competing for the same USB resources. You must 'rmmod' the loaded driver before loading another one that uses the same resources. To see how this is done, see the scripts in the USBnet package which switches between USBnet and USB mass storage (USBMS) gadgets.
Tried to remove g_file_storage first but still same problem.

Quote:
You should be easily able to modify an existing (simple) KUAL extension to support this.
Thanks. I've made a KUAL extension, hope more ppl can test it.


Edit:
can't modify the first post, so here is the KUAL extension.
Unpack and put the folder to /mnt/us/extensions, then launch from KUAL.

Last edited by lucida; 08-01-2016 at 09:22 PM.
lucida is offline   Reply With Quote
Advert
Old 07-22-2016, 05:04 AM   #6
knc1
Analog Forever!
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 15,269
Karma: 16999999
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by lucida View Post
- - - -
can't modify the first post, so here is the KUAL extension.
Unpack and put the folder to /mnt/us/extensions, then launch from KUAL.
That is explained in the 'Guidelines' (link at bottom of page).

Just make a few more posts to the forum and then the system will allow you to edit your existing posts.
knc1 is offline   Reply With Quote
Old 07-22-2016, 09:21 AM   #7
ecc29
Member
ecc29 began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Oct 2015
Device: KPW3
Quote:
Originally Posted by lucida View Post
Tried to remove g_file_storage first but still same problem.
Maybe @NiLuJe knew how to deal with this kind of problem.
ecc29 is offline   Reply With Quote
Old 07-22-2016, 10:10 AM   #8
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10764860
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by ecc29 View Post
Maybe @NiLuJe knew how to deal with this kind of problem.
There might be more than one kernel module to 'rmmod', in reverse order from how they were loaded.
geekmaster is offline   Reply With Quote
Old 07-22-2016, 06:49 PM   #9
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 6,978
Karma: 6562815
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O
IIRC, I stopped playing with rmmod/insmod since the K4 w/ USBNet for various weird reasons (and instead ask the framework to do it for me, here, via volumd).
The usbnet script probably still have my ramblings on that subject in the comments.

Looking into that very thing with the introduction of OTG was the incentive for the PW3 @knc1 is currently tweaking for me, so, TBC .
NiLuJe is offline   Reply With Quote
Old 07-23-2016, 01:47 AM   #10
zxczxc
Addict
zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.zxczxc knows how many angels can dance on the head of a pin.
 
Posts: 227
Karma: 136000
Join Date: Apr 2013
Device: PW
I'm excited about this, I'm wondering what kind of mouse you would recommend in conjunction with this. I love the idea of remote page turning, and the thing I did previusly, relying on phone+wifi was a bit annoying.

Maybe something like https://www.amazon.co.uk/dp/B00DT2Q9OM/
or something like https://www.amazon.co.uk/dp/B008M4X6UW/ would be very cool because there would be no cable in the way.
Ideally something comfortable!
zxczxc is offline   Reply With Quote
Old 07-30-2016, 06:36 AM   #11
lucida
Enthusiast
lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.
 
Posts: 29
Karma: 118906
Join Date: Jul 2016
Device: PW3
Got a new OTG cable and same issue. I noticed that, once the cable was plugged in, even without kernel module and USB mouse, Kindle toggled between host&gadget mode, however USB audio works....

Upon checking I found sth. interesting in arch/arm/mach-mx6/usb_dr.c(complied to fsl_otg_arc.ko)

Code:
int audio_enumerated;
EXPORT_SYMBOL(audio_enumerated);
and audio_enumerated is defined as an extern int in sound/usb/card.c. Changing it to 1(and comment out the EXPORT_SYMBOL line) should bypass the audio card check and make host mode working with other devices. Maybe there're other checks but I didn't dig further. However "rmmod fsl_otg_arc" crashed my PW3, as I don't have serial on it, I didn't try to replace it on rootfs. And, with a USB hub, connecting both USB audio card and mouse might get mouse working.


TL;DR: Find some hidden check in kernel source but can't test it.
lucida is offline   Reply With Quote
Old 07-30-2016, 09:43 AM   #12
knc1
Analog Forever!
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 15,269
Karma: 16999999
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Hard coding the result of the kernel's USB hardware enumeration process is not the answer.
It is a dynamic process for very good reasons.
knc1 is offline   Reply With Quote
Old 07-30-2016, 02:14 PM   #13
lucida
Enthusiast
lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.
 
Posts: 29
Karma: 118906
Join Date: Jul 2016
Device: PW3
Quote:
Originally Posted by knc1 View Post
Hard coding the result of the kernel's USB hardware enumeration process is not the answer.
It is a dynamic process for very good reasons.
hmm...you're right set it to 1 might mess up the gadget mode since it should be 0 then.

It's only used in otg_enum_fn() and we got "otg_enum_fn not enumerated, catcha!" message when OTG cable is plugged in without usb audio card.


Spoiler:

Code:
static void otg_enum_fn(struct work_struct *work)
{
  int reset_delay = (usbmode_is_host == 0 ? 0 : RESET_DELAY);
#ifdef CONFIG_POWER_SODA
  if(!audio_enumerated && soda_charger_docked() && max77696_uic_is_otg_connected() ) {
    printk(KERN_ERR "with soda: %s not enumerated, catcha!", __func__);

    asession_enable__(false);
    soda_otg_vbus_output(0, 0);
    msleep(reset_delay);
    soda_otg_vbus_output(1, 0);
    asession_enable__(true);
    max77696_charger_set_icl();
  }else {
    //printk(KERN_ERR "okay, either otg is not connected, or connected and enumerated successfully. ");
    printk(KERN_ERR "is_otg_connected() %d audio_enumerated %d, soda_charger_docked %d", max77696_uic_is_otg_connected(), audio_enumerated, soda_charger_docked());
  }
#else
  if(!audio_enumerated && max77696_uic_is_otg_connected() ) {
    printk(KERN_ERR " %s not enumerated, catcha!", __func__);
    asession_enable__(false);
    max77696_charger_set_otg(0);
    msleep(reset_delay);
    max77696_charger_set_otg(1);
    asession_enable__(true);
    /* Turn OFF amber led - manual mode */
    max77696_led_ctrl(MAX77696_LED_AMBER, MAX77696_LED_OFF);
    /* Turn OFF green led - manual mode */
    max77696_led_ctrl(MAX77696_LED_GREEN, MAX77696_LED_OFF);
  }else {
    //printk(KERN_ERR "okay, either otg is not connected, or connected and enumerated successfully. ");
    printk(KERN_ERR "is_otg_connected() %d audio_enumerated %d", max77696_uic_is_otg_connected(), audio_enumerated);
  }

#endif
}

Last edited by lucida; 07-30-2016 at 02:19 PM.
lucida is offline   Reply With Quote
Old 08-01-2016, 08:17 PM   #14
lucida
Enthusiast
lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.lucida 's ceiling is 100% spider-free.
 
Posts: 29
Karma: 118906
Join Date: Jul 2016
Device: PW3
OK got it working now. audio_enumerated is used to check usb audio card and its safe to set it to 1 which keeps the device in host mode when OTG cable is plugged.

Here is an updated version of the KUAL extension. Plug in the OTG cable and USB mouse then start from KUAL menu. To stop, remove the OTG cable first then stop from KUAL.

Configuration is in bin/config.sh which detects kindle model automatically. By default, left click/scroll wheel down = next page, right click/wheel up = previous page, middle click = menu(top area)

Have fun.

See first post for downloading.

Last edited by lucida; 08-01-2016 at 09:22 PM.
lucida is offline   Reply With Quote
Old 08-01-2016, 09:04 PM   #15
knc1
Analog Forever!
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 15,269
Karma: 16999999
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by lucida View Post
OK got it working now. audio_enumerated is used to check usb audio card and its safe to set it to 1 which keeps the device in host mode when OTG cable is plugged.

Here is an updated version of the KUAL extension. Plug in the OTG cable and USB mouse then start from KUAL menu. To stop, remove the OTG cable first then stop from KUAL.

Configuration is in bin/config.sh which detects kindle model automatically. By default, left click/scroll wheel down = next page, right click/wheel up = previous page, middle click = menu(top area)

Have fun.
I guess that is a pretty good answer to this post:
Quote:
Originally Posted by Yourcat View Post
I suspect that I'll never see one in real live using a Kindle with a random USB device connected.
knc1 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tools Software Jailbreak for PW2, PW3, PW3W, KT2, KV, KOA and KT3 knc1 Kindle Developer's Corner 2863 Today 09:22 AM
USB device to turn the page arnicas Kindle Developer's Corner 23 02-20-2017 02:20 PM
CC and USB/OTG support GEB Calibre Companion 2 05-30-2015 01:24 PM
ebook android readers and usb host - otg support sasimako Which one should I buy? 4 02-18-2015 07:26 AM
USB OTG Mythic Bookeen 7 11-11-2007 01:39 PM


All times are GMT -4. The time now is 09:55 PM.


MobileRead.com is a privately owned, operated and funded community.