Giter Site home page Giter Site logo

swinput's Introduction

Swinput can fake mouse and keyboard input using the Linux Input System. 

The swinput modules read from a device and fake hardware events 
(mouse motions, keyboard input, etc). Swinput presents status on the proc filesystem.

As of May 2006 only kernel 2.6 is supported.


1 Building and installing
========================================

  tar zxvf swinput-0.5.tar.gz
  make
  make install (as root)


If you are using devfs you are finished with building and installation. 
Otherwise you have to create the devices manually;

 ** You most likely don't need to exec the below commands **

  mknod /dev/swmouse c 10 $(grep swmouse /proc/misc | awk '{print $1}')
  mknod /dev/swkeybd c 10 $(grep swkeybd /proc/misc | awk '{print $1}')


  make try
    inserts the modules (using sudo)

  make check
    runs the test scripts in test/ (using sudo)

  make dist 
    builds a dist package (incl gpg sig) for upload 



2 Mouse Usage
========================================

Load module with "modprobe swmouse"
type "modinfo swmouse" to get a list of possible arguments.

- You can define the maximum screen resolution using the "xmax" and "ymax" 
module-parameters.
Use the "devs" parameter if you need more than one fake-mouse. Currently a
maximum of 16 different fake-devices are supported.

-Supress any syslog output by using "log=0". To see general messages use "log=1"
and for full debugging output use "log=2" (please use "log=2" when reporting 
bugs)

- By writing to /dev/swmouse0 you can fake 'mouse input'. 


The following syntax is used 

Option      Interpretation
---------   ---------------------------------
u nr        Moves the mouse up <nr> pixels	           
d nr        Moves the mouse down <nr> pixels	           
l nr        Moves the mouse left <nr> pixels	           
r nr        Moves the mouse right <nr> pixels	           
x nr        Moves the mouse to x position=<nr> (untested)
y nr        Moves the mouse to y position=<nr> (untested)
0           Moves to origin and resets stats


3 Keyboard Usage
========================================

Load module with "modprobe swkeybd"

By writing to /dev/swkeybd you can fake 'keyboard input'. 
The following syntax is used 

Option           Interpretation
---------        ---------------------------------
str              The string 'str' is typed by the faked keyboard
[Fx]             The key Fx (e.g F2) is pressed. x can be 1-20
[KEY_BACKSPACE]  Backspace is typed 
[KEY_ENTER]      Enter is typed
[KEY_SPACE]      Space is typed
[KEY_COMMA]      , is typed
[KEY_DOT]        . is typed
[KEY_LEFT]       Left (arrow) key is typed
[KEY_RIGHT]      Right (arrow) key is typed
[KEY_DOWN]       Down (arrow) key is typed
[KEY_UP]         Up (arrow) key is typed


4 Usage staticstics
========================================
In the proc tree (/proc) you'll find usage statistics.


4.1 swmouse usage statistics
----------------------------------------

If you read /proc/swmouse (e.g. by typing cat /proc/swmouse)
you get the following information:

swmouseX:u:d:l:r:x:y

where:
  X     mouse-device
  u     means the number of pixels we've moved up so far
  d     means the number of pixels we've moved down so far
  l     means the number of pixels we've moved left so far
  r     means the number of pixels we've moved right so far
  x     means the number of times we've moved to a fix x position
  y     means the number of times we've moved to a fix y position

You can zero the statistics counters by writing zero to the
proc file (e.g echo "0" > /dev/swmouse) 


4.2 swkeybd usage statistics
----------------------------------------

If you read /proc/swkeybd (e.g. by typing cat /proc/swkeybd)
you get the following information:

swkeybd:p:r:s_p:s_r

where:
  p     means the number of key presses so far
  r     means the number of key releases so far
  s_p   means the number of shift key presses so far
  s_r   means the number of shift key releases so far

You can set the statistics counters to zero by writing zero to the
proc file (e.g echo "0" > /dev/swkeybd) 


5 Examples
========================================

echo "u 10" > /dev/swmouse0   
   Moves the pointer up 10 pixels

echo "d 123" > /dev/swmouse0   
   Moves the pointer down 123 pixels

echo "ls -l [ENTER]" > /dev/swkeybd
   Types 'ls -l' followed by enter

   .. so you should see a file/dir listing if you 
   have as your focus a terminal emulator or a console.


6 Bugs
========================================

Please report bugs at 
http://savannah.nongnu.org/bugs/?group=swinput

swinput's People

Contributors

hesa avatar

Stargazers

Rikard Fröberg avatar

Watchers

James Cloos avatar  avatar Rikard Fröberg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.