Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-09-2014, 12:32 AM   #1
0x5e
Junior Member
0x5e began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2014
Device: kindle 4 black
Question Remote keyboard

Sorry for my poor English.
Although I have a holder to hold my k4, I still have to put my hand on page down button,which makes me unconfortable.So I have an idea:How about using mobile phone to control k4 keyborad?


Code:
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <linux/input.h>
#include <fcntl.h>

//#include "input.h"

#define EV_NONE 0
#define EV_PRESS 1

void put_kbd(int fd,unsigned short key)
{
    struct input_event iev;

    iev.type = 0x04;
    iev.code = 0x04;
    iev.value= EV_PRESS;
    gettimeofday(&iev.time,NULL);
    write(fd,&iev,sizeof(iev));

    iev.type = 0x01;
    iev.code = key;
    iev.value= EV_PRESS;
    gettimeofday(&iev.time,NULL);
    write(fd,&iev,sizeof(iev));

    iev.type = 0x00;
    iev.code = 0x00;
    iev.value= EV_NONE;
    gettimeofday(&iev.time,NULL);
    write(fd,&iev,sizeof(iev));

}

void put_fw(int fd,unsigned short key)
{

    struct input_event iev;

    iev.type = 0x01;
    iev.code = key;
    iev.value= EV_PRESS;
    gettimeofday(&iev.time,NULL);
    write(fd,&iev,sizeof(iev));

    iev.value= EV_NONE;
    gettimeofday(&iev.time,NULL);
    write(fd,&iev,sizeof(iev));
}

int main(int argc, char* argv[])
{
    int fd_kbd,fd_fw;
    int key;

    if((fd_kbd = open("/dev/input/event0",O_RDWR))<-1)
    {
        printf("error open keyboard\n");
        return -1;
    }

    if( (fd_fw  = open("/dev/input/event1",O_RDWR))<-1)
    {
        printf("error open keyboard_fw\n");
        return -1;
    }

    printf("Start remote control.\n");
    while(scanf("%d",&key)!=-1 && key > 0 && key < 255)
    {
        put_fw(fd_fw,key);
        put_kbd(fd_kbd,key);
    }

    if(fd_fw>-1)
    {
        close(fd_fw);
    }

    if(fd_kbd>-1)
    {
        close(fd_kbd);
    }

    printf("Exit.\n");

    return 0;
}
using this code,I can simulate keyboard through wifi+ssh ,in computer.
but I want to use mobile phone to control k4,and I don't know how to write an android application to control k4 through ssh?
0x5e is offline   Reply With Quote
Old 05-09-2014, 02:39 AM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Someone already did this, here: https://www.mobileread.com/forums/showthread.php?t=203479

It grants control of your Kindle through the browser.

Last edited by eschwartz; 05-09-2014 at 02:43 AM.
eschwartz is offline   Reply With Quote
Advert
Old 05-11-2014, 03:25 AM   #3
0x5e
Junior Member
0x5e began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2014
Device: kindle 4 black
Quote:
Originally Posted by eschwartz View Post
Someone already did this, here: https://www.mobileread.com/forums/showthread.php?t=203479

It grants control of your Kindle through the browser.
thank you very much
0x5e is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote X11? timb.us Kindle Developer's Corner 74 04-20-2013 11:23 PM
HD Fire HD Keyboard and Bluetooth Keyboard? Doc109 Kindle Fire 18 01-29-2013 09:54 AM
Keyboard entry when no keyboard is displaying geneven1 enTourage eDGe 5 06-14-2011 06:07 AM
Your vote - keyboard or no keyboard on Kindle mrzerga Amazon Kindle 56 03-10-2011 07:22 PM
Accessories Remote Kumabjorn Amazon Kindle 20 07-19-2010 04:30 PM


All times are GMT -4. The time now is 01:28 AM.


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