´ÙÀ½ ÀÌÀü Â÷·Ê

3. X-window ½ÇÇà Áß¿¡ ¼³Á¤ º¯°æÇϱâ

ÀÌ ÀåÀº ÁÖ ÀÔ·ÂÀåÄ¡(core pointer)¸¦ º¯°æÇÏ´Â ¹æ¹ý°ú ¹öÆ° ¸ÊÇÎÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÑ´Ù.

3.1 ÁÖ ÀÔ·ÂÀåÄ¡(core pointer) º¯°æÇϱâ : xsetpointer

´ÙÀ½°ú °°ÀÌ XF86ConfigÀÇ Xinput Section¿¡ AlwaysCoreÀ» ¼³Á¤ÇÏÁö ¾Ê¾Ò´Ù¸é ÇöÀç »óÅ¿¡¼­´Â ¸¶¿ì½º¸¸ »ç¿ëÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ±×·¸´Ù¸é Ÿºí·¿À» »ç¿ëÇϱâ À§Çؼ­´Â X-windowÀ» Àç½ÇÇàÇØ¾ß Çϳª? ±×·¸Áö´Â ¾Ê´Ù.

Section "Xinput" 

    SubSection "WacomStylus"
        Port "/dev/ttyS0"
        DeviceName "Wacom"
        Mode Absolute
        Suppress 6
    EndSubSection
    SubSection "WacomEraser"
        Port "/dev/ttyS0"
        Mode Absolute
    EndSubSection
    ...
EndSection

xsetpointer´Â ÁÖ ÀÔ·Â ÀåÄ¡¸¦ ¹Ù²ãÁÖ´Â ÇÁ·Î±×·¥ÀÌ´Ù.

xsetpointer < ÀåÄ¡¸í >
xsetpointer -l

¸ÕÀú »ç¿ë °¡´ÉÇÑ ÀåÄ¡ ¸ñ·ÏÀ» º¸ÀÚ.

xsetpointer -l
"pointer"       [XPointer]
"keyboard"      [XKeyboard]
"SWITCH"        [XExtensionDevice]
"Wacom" [XExtensionDevice]
"ERASER"        [XExtensionDevice]
"CURSOR"        [XExtensionDevice]

pointer´Â ¸¶¿ì½º, keyboard´Â Å°º¸µå, ³ª¸ÓÁö´Â Ÿºí·¿ ÀåÄ¡µéÀÌ´Ù. ÁÖ ÀÔ·Â ÀåÄ¡¸¦ Ÿºí·¿À¸·Î ¹Ù²ãº¸ÀÚ. Ÿºí·¿À» ÁÖ ÀÔ·Â ÀåÄ¡·Î ¹Ù²Ù¸é ¸¶¿ì½º´Â »ç¿ëÇÒ ¼ö ¾ø°Ô µÈ´Ù.

truefeel: # xsetpointer wacom

3.2 ¸ðµå º¯°æÇϱâ : xsetmode

¸ðµå¸¦ ÀüȯÇÏ´Â xsetmodeÀº »ç¿ëÀÌ °£´ÜÇϹǷΠƯº°È÷ ¼³¸íÇÒ °ÍÀÌ ¾ø´Ù.

 xsetmode <ÀåÄ¡¸í> (ABSOLUTE|RELATIVE)

xsetmode wacom absolute

3.3 ¹öÆ° ¸ÊÇÎÇϱâ : xmodmap

xmodmapÀº Å°º¸µå ¹× Æ÷ÀÎÅÍ(¸¶¿ì½º, Ÿºí·¿ µî) ¹öÆ° ¸ÊÇο¡ »ç¿ëÇÏ´Â À¯Æ¿¸®Æ¼ ÀÌ´Ù. Å°º¸µåÀÇ Å° ¸ÊÇÎÀ» È®ÀÎÇϰųª º¯°æÇϴµ¥ ÇÑ ¹ø¾¿Àº »ç¿ëÇØ ºÃÀ» °ÍÀÌ´Ù. Å°¸ÊÇÎÀº À̱ÛÀÇ ÁÖÁ¦¿Í ¾î¿ï¸®Áö ¾ÊÀ¸¹Ç·Î Æ÷ÀÎÅÍÀÇ ¹öÆ° ¸ÊÇο¡ ´ëÇؼ­¸¸ ¼³¸íÇÑ´Ù.

 xmodmap -pp
 xmodmap -e "pointer = ³í¸®¹öÆ°1 ³í¸®¹öÆ°2 ³í¸®¹öÆ°3 ..."

xmodmapÀº ÁÖ ÀÔ·Â ÀåÄ¡(core pointer)·Î ÁöÁ¤µÈ ÀåÄ¡ÀÇ ¹öÆ°À» ¸ÊÇÎÇϹǷΠ¼³Á¤ Àü¿¡ ¹Ýµå½Ã ÁÖ ÀÔ·Â ÀåÄ¡¸¦ Å×ºí·¿ ÀåÄ¡·Î ºü²ã¾ß ÇÑ´Ù. ¹öÆ° ¸ÊÇÎÀ» È®ÀÎÇØ º¸ÀÚ. ¹°¸®Àû ¹öÆ°°ú ³í¸®Àû ¹öÆ°ÀÌ °°À½À» ¾Ë ¼ö ÀÖ´Ù.

truefeel:~# xsetpointer wacom
truefeel:~# xmodmap -pp
There are 4 pointer buttons defined.

    Physical        Button
     Button          Code
        1              1
        2              2
        3              3
        4              4

¹°¸®Àû ¹öÆ° 1Àº ³í¸®Àû ¹öÆ° 2·Î, ¹°¸®Àû ¹öÆ° 2´Â ³í¸®Àû ¹öÆ° 1·Î, ¹°¸®Àû ¹öÆ° 3Àº ³í¸®Àû ¹öÆ° 3À¸·Î, ¹°¸®Àû ¹öÆ° 4Àº ³í¸®Àû ¹öÆ° 4·Î ¹Ù²ãº¸ÀÚ.

xmodmap -e "pointer = 2 1 3 4"

3.4 XInput ÀåÄ¡ÀÇ Å×½ºÆ® ¹× ¼³Á¤ À¯Æ¿¸®Æ¼ : xinput

Frederic Lepied°¡ ¸¸µç xinputÀº Wacom Ÿºí·¿°ú °°Àº XInput ÀåÄ¡¸¦ Å×½ºÆ®ÇÏ°í ¼³Á¤ÇÏ´Â À¯Æ¿¸®Æ¼´Ù. xinput À¯Æ¿¸®Æ¼´Â ¾Õ¿¡¼­ ¼³¸íÇÑ xsetpointer, xsetmode, xmodmapÀÇ ±â´ÉÀ» ¸ðµÎ °¡Áö°í ÀÖ´Ù.

xinputÀº ftp://ftp.x.org/contrib/utilities/xinput-1.2.tar.gz ¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù. ¼³Ä¡´Â ¿ì¼± tar·Î Ǭ ´ÙÀ½ Imakefile -> Makefile »ý¼º(xmkmf)ÇÏ°í 2¹øÀÇ make °úÁ¤À» °ÅÄ¡¸é µÈ´Ù.

truefeel:~# tar xvfz xinput-1.2.tar.gz 
xinput-1.2/
xinput-1.2/xinput.man
xinput-1.2/Imakefile
xinput-1.2/README
xinput-1.2/ChangeLog
xinput-1.2/COPYRIGHT
...
truefeel:~# cd xinput-1.2
truefeel:~/xinput-1.2# xmkmf -a
truefeel:~/xinput-1.2# make install
truefeel:~/xinput-1.2# make install.man

¸¸µé¾îÁø xinput°ú xinput ¸ÇÆäÀÌÁö´Â °¢°¢ /usr/X11R6/bin, /usr/X11R6/man/man1¿¡ ¼³Ä¡µÈ´Ù.

xinput »ç¿ëÇÒ ¶§ ÁÖÀÇÇÒ °ÍÀº ÀåÄ¡¸íÀÇ ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐ ÇÑ´Ù´Â °ÍÀÌ´Ù. ÀåÄ¡¸íÀº XF86ConfigÀÇ XInput ¼½¼Ç¿¡¼­ DeviceName ¿É¼ÇÀ¸·Î ÁöÁ¤ÇÑ´Ù.

SubSection "WacomStylus"
     Port            "/dev/ttyS0"
     DeviceName      "Wacom"
EndSubSection

ÀÌÁ¦ xinput ±â´ÉÀ» »ó¼¼ÇÏ°Ô ¾Ë¾Æº¸ÀÚ.

* ÀÔ·ÂÀåÄ¡ ¸ñ·Ï º¸±â : xinput list [ ÀåÄ¡¸í ]

ÁöÁ¤ÇÑ ÀÔ·ÂÀåÄ¡¿¡ ´ëÇÑ »ó¼¼ÇÑ Á¤º¸¸¦ º¸¿©ÁØ´Ù. ÀåÄ¡¸íÀ» ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸é ¸ðµç ÀÔ·ÂÀåÄ¡¿¡ ´ëÇÑ Á¤º¸¸¦ Ãâ·ÂÇÑ´Ù. »ó´çÈ÷ ÀÚ¼¼ÇÑ Á¤º¸¸¦ º¸¿©ÁֹǷΠ°¡´ÉÇϸé ÀåÄ¡¸íÀ» ÁöÁ¤Çϱ⠹ٶõ´Ù.

truefeel:~# xinput list Wacom
"Wacom" id=3    [XExtensionDevice]
        Num_keys is 32
        Min_keycode is 8
        Max_keycode is 39
        Num_buttons is 4
        Num_axes is 5
        Mode is Absolute
        Motion_buffer is 0
        Axis 0 :
                Min_value is 0
                Max_value is 10240
                Resolution is 499999
        Axis 1 :
                Min_value is 0
                Max_value is 7680
                Resolution is 499999
...

´Ü¼øÈ÷ ÀÔ·Â ÀåÄ¡ÀÇ ¸ñ·Ï¸¸À» È®ÀÎÇÏ°í ½Í´Ù¸é ¾Õ¼­ ¹è¿î xsetpointer -lÀ» ÀÌ¿ëÇϰųª xinput À» ´ÙÀ½°ú °°ÀÌ ÀÌ¿ëÇصµ µÈ´Ù.

xinput list|grep '^"' 

* ÁÖ ÀÔ·ÂÀåÄ¡(core pointer) ¹Ù²Ù±â : xinput set-pointer < ÀåÄ¡¸í >

ÁÖ ÀÔ·ÂÀåÄ¡¸¦ º¯°æÇÑ´Ù. xsetpointer < ÀåÄ¡¸í > °ú °°Àº ±â´ÉÀ» ÇÑ´Ù.

* Àý´ëÁÂÇ¥, »ó´ëÁÂÇ¥ ¸ðµå ¹Ù²Ù±â : xinput set-mode < ÀåÄ¡¸í > ABSOLUTE|RELATIVE

ÁöÁ¤ÇÑ ÀÔ·ÂÀåÄ¡ÀÇ ¸ðµå¸¦ Àý´ë ¶Ç´Â »ó´ë ¸ðµå·Î ¹Ù²Û´Ù. xsetmode < ÀåÄ¡¸í > ABSOLUTE|RELATIVE °ú °°Àº ±â´ÉÀ» ÇÑ´Ù.

* ¹öÆ° ¸ÊÇÎÇϱâ : xinput set-button-map < ÀåÄ¡¸í > ³í¸®¹öÆ°1 ³í¸®¹öÆ°2 ...

ÀÔ·ÂÀåÄ¡ÀÇ ¹°¸®¹öÆ°À» ÁöÁ¤ÇÑ ¼ø¼­´ë·Î ³í¸®¹öÆ°À¸·Î ¸ÅÇνÃŲ´Ù.

xinput set-button-map Wacom 2 1 3 4

* ÀÔ·ÂÀåÄ¡ »óÅ ȮÀÎÇϱâ : xinput query-state < ÀåÄ¡¸í >

ÀÔ·ÂÀåÄ¡ÀÇ »óŸ¦ È®ÀÎÇÑ´Ù.

truefeel:~# xinput query-state Wacom
3 classes :
KeyClass
        key[0]=up
        key[1]=up
...
        key[31]=up
ButtonClass
        button[1]=up
        button[2]=up
        button[3]=up
        button[4]=up
ValuatorClass Mode=Absolute Proximity=In
        valuator[0]=4389
        valuator[1]=5728
        valuator[2]=-128
        valuator[3]=30
        valuator[4]=-9

À§ÀÇ ½ÇÇà °á°ú´Â Å° ÄÚµå »óÅÂ(KeyClass), ¹öÆ° »óÅÂ(ButtonClass), Ãà »óÅÂ(ValuatorClass) µî 3°¡Áö »óŸ¦ Á¦°øÇÑ´Ù. 32°³ÀÇ Å°, 4°³ÀÇ ¹öÆ°ÀÌ µ¿ÀÛÇÏ°í ÀÖÀ¸¸ç ¸ðµå´Â Àý´ë ¸ðµå(Mode=Absolute), Ææ ¶Ç´Â ¿¡¾îºê·¯½¬°¡ ÀԷ¹ÞÀ» ¼ö ÀÖ´Â °Å¸®(Proximity=In)¿¡ ÀÖÀ½À» ¾Ë ¼ö ÀÖ´Ù. Ãà »óÅ°¡ ³ªÅ¸³»´Â °ªÀÇ Àǹ̴ ´ÙÀ½°ú °°´Ù.

  1. valuator[0] : XÁÂÇ¥
  2. valuator[1] : YÁÂÇ¥
  3. valuator[2] : Ææ ¶Ç´Â ¿¡¾îºê·¯½¬°¡ ´©¸£´Â ¾Ð·Â. -128Àº ´©¸£°í ÀÖÁö ¾ÊÀ½.
  4. valuator[3] : X¹æÇâ ±â¿ï±â. À½¼ö °ªÀº ¿ÞÂÊ, ¾ç¼ö °ªÀº ¿À¸¥ÂÊÀ¸·Î ±â¿ï¸².
  5. valuator[4] : Y¹æÇâ ±â¿ï±â. À½¼ö °ªÀº À§ÂÊ, ¾ç¼ö °ªÀº ¾Æ·¡ÂÊÀ¸·Î ±â¿ï¸².

* ÀÔ·ÂÀåÄ¡ Å×½ºÆ®Çϱâ : xinput test [ -proximity ] < ÀåÄ¡¸í >

ÀÔ·ÂÀåÄ¡¸¦ Å×½ºÆ®ÇÏ´Â ±â´ÉÀ¸·Î ÀåÄ¡¸¦ ÅëÇØ ÀԷµǴ ¸ðµç À̺¥Æ®¸¦ ¿¬¼ÓÀûÀ¸·Î º¸¿©ÁØ´Ù. Å×½ºÆ®¸¦ ³¡³»·Á¸é Ctrl+C¸¦ ´©¸¥´Ù.

-proximity : Á¢±Ù¼º±îÁö Ç¥½ÃÇØÁØ´Ù. proximity in / proximity out

truefeel:~# xinput test -proximity Wacom
...
motion a[0]=4572 a[1]=5142 a[2]=-128 a[3]=30 a[4]=-12 
motion a[0]=4563 a[1]=5200 a[2]=-128 a[3]=30 a[4]=-12 
motion a[0]=4553 a[1]=5261 a[2]=-128 a[3]=30 a[4]=-14 
button release 2 a[0]=4553 a[1]=5261 a[2]=0 a[3]=30 a[4]=-13 
proximity out a[0]=4553 a[1]=5261 a[2]=-128 a[3]=30 a[4]=-14 
motion a[0]=4571 a[1]=5259 a[2]=-128 a[3]=27 a[4]=-10 
proximity out a[0]=4606 a[1]=5208 a[2]=-128 a[3]=29 a[4]=-11 
proximity in  a[0]=4606 a[1]=5208 a[2]=-128 a[3]=29 a[4]=-11 
motion a[0]=6031 a[1]=4948 a[2]=-128 a[3]=-14 a[4]=13 
motion a[0]=6085 a[1]=4996 a[2]=-128 a[3]=-15 a[4]=14 
...


´ÙÀ½ ÀÌÀü Â÷·Ê