my B011 KT International has TTS. I think there may be one or two of them left for sale. (link on here somewhere).
It is entirely possible to initiate TTS programmatically (and thus off of a button)
here's the relevant bits to prod.
Quote:
com.lab126.tts
w Int pause
w Int unpause
w Int CtrlBookmark
w Int stop
rw Str logLevel
rw Str logMask
rw Has playFile
rw Str TtsSModel
rw Int TextToProcess
rw Str TtsSVoice
rw Int TtsISpeed
However you say you have a KK.
and running a lipc-probe -a on there tells the same story
Quote:
com.lab126.tts
rw Str TtsSVoice
w Int CtrlBookmark
rw Has playFile
rw Int TextToProcess
w Int stop
rw Str logMask
w Int pause
rw Str logLevel
w Int unpause
rw Str TtsSModel
rw Int TtsISpeed
so again, should be just as easy to make a KK use ONE key to do both jobs as it would be to make a KT do it with one "button" push.
My thought would be dig around and see if there is already a solution to just trigger that. I am guessing not but it shouldn't be too difficult to rig up...
I want to add my brute force contribution to this topic. I wrote a very simple program, whose main aim is to turn Kindle Touch into a Non-Touch .
It just grabs all X events – keyboard (read One Key) and touchscreen input, so that the events don't reach other apps. It is just a proof of concept which may be further developed or used for some other project.
I adjusted the program to what was asked for in one of the previous posts in this thread. It disables touchscreen input and turns home button events into touchscreen events, so that home button may be used to turn pages in reader application.
When started program waits for pressing home button. When you press the home button, the touchscreen becomes inactive. There is only small 50×50 pixels active area in the upper right corner of the screen. Touching this area turns the program off.
Home button presses are translated into touchscreen clicks. Short button press simulates click on the right side of the screen – forward page turn. Long button press imitates click on the left side of the screen – backward page turn. Duration of the long press may be adjusted on command line.
I also prepared a GUI Launcher extension for those who don't want to mess around with command line. To use for reading a book start the extension from extensions folder. Then click on the book you want to read and when it opens just press home button. From this moment home button will work as described above and touchscreen will not work. To turn it off you will need to click in the upper right corner of the screen.
[root@kindle bin]# ./untouchable -h
Usage: untouchable [OPTION]
-t <milliseconds> - minimal time home button should be hold to be treated as long press (default 1500)
-d - debug
-h - show this message
untouchable.c:
Spoiler:
Code:
/*
untouchable - filter all input and make Kindle Touch "untouchable" :)
Copyright (c) 2012 by baf (www.fabiszewski.net), with MIT license:
http://www.opensource.org/licenses/mit-license.php
gcc untouchable.c -O2 -Wall -lX11 -o untouchable
*/
#include <stdio.h> // printf
#include <stdbool.h> // bool
#include <string.h> // memset
#include <stdlib.h> // strtol
#include <unistd.h> // usleep
#include <X11/keysym.h>
#include <X11/XKBlib.h>
void pageForward(Display *display);
void pageBackward(Display *display);
void SendMouseEvent(Display *display, int button, int x, int y, bool pressed);
void usage();
bool debug = false;
int main(int argc, char * argv[]) {
Window root;
Display * display;
XEvent xev;
Time clickTime = CurrentTime;
int longPressDuration = 1500;
int timeDiff;
int screenWidth;
// parse options
while ((argc > 1) && (argv[1][0] == '-')){
switch (argv[1][1]){
case 't':
++argv;
if (--argc <= 1){
printf("Option -t requires numeric argument\n");
usage();
return 1;
}
longPressDuration = strtol(argv[1],0,0);
break;
case 'd':
debug = true;
break;
case 'h':
usage();
return 0;
}
++argv;
--argc;
}
if(debug) printf("Long press duration: %i\n", longPressDuration);
display = XOpenDisplay(NULL);
if(display == NULL) {
if(debug) printf("Could not open display\n");
return 1;
}
root = DefaultRootWindow(display);
screenWidth = WidthOfScreen(DefaultScreenOfDisplay(display));
if(debug) printf("Screen width: %i\n", screenWidth);
XAllowEvents(display, AsyncBoth, CurrentTime);
// grab key events
if(debug) printf("Grab key events\n");
XGrabKeyboard(display, root, true, GrabModeAsync, GrabModeAsync, CurrentTime);
bool go = true;
bool grabOn = false; // we start grabbing mouse events only after first press of home button
while(go){
XNextEvent(display, &xev);
int keycode = (int) XLookupKeysym(&xev.xkey, 0);
switch(xev.type){
case ButtonPress:
if(debug) printf("Button press - %i\n", xev.xbutton.button);
if(debug) printf("Coordinates - %i, %i\n", xev.xbutton.x, xev.xbutton.y);
break;
case ButtonRelease:
if(debug) printf("Button release - %i\n", xev.xbutton.button);
if(xev.xbutton.x>screenWidth-50 && xev.xbutton.y<50)
go = false;
break;
case KeyPress:
clickTime = xev.xkey.time;
if(debug) printf("Key press - %i\n", keycode);
break;
case KeyRelease:
timeDiff = (long) xev.xkey.time - (long) clickTime;
if(debug) printf("Key release - %i\n", keycode);
if(debug) printf("Key press duration - %i\n", timeDiff);
// FIXME: test for keycode is rather useless :)
if(keycode == XK_Home && grabOn){
if(timeDiff < longPressDuration)
pageForward(display);
else
pageBackward(display);
} else {
// first press of home button
if(debug) printf("Grab mouse events\n");
grabOn = true;
XGrabButton(display, AnyButton, AnyModifier, root, true, ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
}
break;
}
}
XUngrabKeyboard(display, CurrentTime);
if(grabOn) XUngrabButton(display, AnyButton, AnyModifier, root);
XCloseDisplay(display);
return 0;
}
void pageForward(Display *display){
SendMouseEvent(display, Button1, 500, 300, true);
usleep(10000);
SendMouseEvent(display, Button1, 500, 300, false);
}
void pageBackward(Display *display){
SendMouseEvent(display, Button1, 50, 300, true);
usleep(10000);
SendMouseEvent(display, Button1, 50, 300, false);
}
void SendMouseEvent(Display *display, int button, int x, int y, bool pressed){
XEvent event;
memset(&event, 0, sizeof(event));
event.xbutton.type = pressed ? ButtonPress : ButtonRelease;
event.xbutton.button = button;
event.xbutton.same_screen = true;
XQueryPointer(display, RootWindow(display, DefaultScreen(display)),
&event.xbutton.root, &event.xbutton.window, &event.xbutton.x_root,
&event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, &event.xbutton.state);
event.xbutton.subwindow = event.xbutton.window;
while(event.xbutton.subwindow){
event.xbutton.window = event.xbutton.subwindow;
XQueryPointer(display, event.xbutton.window,
&event.xbutton.root, &event.xbutton.subwindow, &event.xbutton.x_root,
&event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, &event.xbutton.state);
}
event.xbutton.x = x;
event.xbutton.y = y;
if(debug) printf("Sending %i %i event: %ix%i\n", event.xbutton.type, event.xbutton.button, x, y);
if (!XSendEvent(display, PointerWindow, true, 0xfff, &event))
printf("Failed to send mouse event\n");
XFlush(display);
}
void usage(){
printf("Usage: untouchable [OPTION]\n");
printf(" -t <milliseconds> - minimal time home button should be hold to be treated as long press (default 1500)\n");
printf(" -d - debug\n");
printf(" -h - show this message\n");
}
Hi Baf. Do you think this would be a sensible starting place for a nicely locked down games interface?
I got the prboom thing to finally not lock due to Xorg hating on SDL and I guess I'm looking for a few other pieces of the puzzle. I do already have two TS parsing bits of code (mplayer gui, and GM code) but this actually seemed like a nice way to -STOP cvm (or not) and just overlay the game.