Enable/Disable Linux mousekeys
gcc mousekey.c -lX11 -IX11
´ò¿ªmousekeysÔËÐÐ./a.out
¹Ø±ÕmousekeysÔËÐÐ./a.out 1,ÕâÀïÔÚa.outºóÃæËæ±ã¼ÓÒ»¸ö²ÎÊý¾Í¿ÉÒÔÁË£¬ÒòΪÅжÏÌõ¼þΪ if(argc < 2)
/*********source code***************/
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
int main(int argc, char *argv[])
{
Display *display;
unsigned long which;
XkbDescPtr xkb;
unsigned int status_mask = 0;
unsigned short mk_delay = 160;
unsigned short mk_interval = 50;
unsigned short mk_time_to_max = 30;
unsigned short mk_max_speed = 50;
short mk_curve = 0;
Status S;
status_mask = XkbMouseKeysMask;
display = XOpenDisplay(NULL);
xkb = XkbGetMap(display, 0, XkbUseCoreKbd);
if((int)xkb == BadAlloc || xkb == NULL)
{
printf("ERROR: unable to allocate storege.\n");
return 1;
}
if((S = XkbGetControls(display, XkbAllControlsMask, xkb)) != Success)
{
if(S == BadAlloc)
printf("ERROR: Unable to allocate storage.\n");
else if(S == BadMatch)
printf("ERROR: Unable to query state of keyboard.\n");
else printf("ERROR: Unable to get state of keyboard controls. \n");
return 2;
}
unsigned int changeEnabled = 0;
unsigned int enabled = 0;
changeEnabled |=status_mask;
if(argc < 2)
enabled |= status_mask;
if(xkb->ctrls)
{
xkb->ctrls->enabled_ctrls &=~changeEnabled;
xkb->ctrls->enabled_ctrls |=(changeEnabled & enabled);
xkb->ctrls->mk_delay = mk_delay;
xkb->ctrls->mk_interval = mk_interval;
xkb->ctrls->mk_time_to_max = mk_time_to_max;
xkb->ctrls->mk_max_speed = mk_max_speed;
&nb
Ïà¹ØÎĵµ£º
ÔÚLinuxÖÐÓÃttySxµÄÐÎʽÀ´±íʾ´®¿ÚÉ豸Ãû£¬Èç COM1±»±íʾΪttyS0£¬COM2±»±íʾΪttyS1£¬ÒÔ´ËÀàÍÆ¡£ÏÂÃæÕâ¸öÃüÁîÏÔʾϵͳÖб»¼ì²âµ½µÄ´®¿Ú£º
# dmesg | grep ttyS
[ 25.942157] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 25.942840] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) ......
¿ÉÒÔͨ¹ýÏÂÃæÃüÁî²é¿´µ±Ç°±àÂ뷽ʽ£º
h@debian-server:~/$ locale -a
C
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
POSIX
zh_CN
zh_CN.gb1 ......
ǰÑÔ£º
µ±ÎÒÃÇʹÓÃǶÈëʽlinux ½øÐпª·¢Ê±£¬kernel ÅÜÆðÀ´Ö®ºó£¬ÎÒÃÇÏ£ÍûÄÜͨ¹ý´®¿Ú£¨±ê×¼ÊäÈë¡¢Êä³ö£©£¬ÔÚÓ¦ÓóÌÐòÕýÔÚÔËÐеĹý³ÌÖУ¬½øÐÐһЩµ÷ÊÔ¹¤×÷£¬ÀýÈ磬¶ÔCPUһЩ¼Ä´æ½øÐе÷Õû£¬ÒÔ¹Û²âµ÷ÕûÒÔºóµÄ½á¹û£¬²¢ÇÒ£¬µ±ÎÒÃÇÎÞ·¨°ÑÎÒÃǵÄÓ¦ÓóÌÐò·ÅÔÚºǫ́ÔËÐУ¬ÄÇôÎÒÃǾÍÐèÒªÊ ......
À´Ô´linux-2.6.20.21/Documentation/kbuild/makefiles.txt
* obj-y
+= foo.o ±íʾ±àbuild-in£¬obj-m += foo.o±íʾ±à³Émodule.
* kbuild
»á±àÒëËùÓеÄ$(obj-y)Îļþ£¬È»ºóµ÷ÓÃ$(LD) -r°ÑÕâЩÎļþºÏ²¢µ½Ò»¸öbuilt-in.oÎļþÖС£Õâ¸öbuilt-in.oÉÔºó»á±»¸¸¼¶Makefile linkµ½vmlinux
* ÓÃlib-y
:= checksum.o ......
Ò»¡¢ÏÂÔØ
gd-2.0.33.tar.gz http://www.boutell.com/gd/
jpegsrc.v6b.tar.gz http://www.ijg.org/
libpng-1.2.7.tar.tar http://sourceforge.net/projects/libpng/
zlib-1.2.2.tar.gz http://sourceforge.net/projects/zlib/
freetype-2.1.9.tar.gz http://sourceforge.net/projects/freetype/
php-4.3.9.tar.g ......