Skip to content

jayschwa/swinput

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.


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

  tar zxvf swinput-0.x.x.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	           
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
[BACKSPACE]      Backspace is typed
[ENTER]          Enter is typed
[SPACE]          Space is typed
[COMMA]          , is typed
[DOT]            . is typed
[LEFT]           Left (arrow) key is typed
[RIGHT]          Right (arrow) key is typed
[DOWN]           Down (arrow) key is typed
[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:
https://github.com/jayschwa/swinput/issues

or the original site:
http://savannah.nongnu.org/bugs/?group=swinput

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published