»ç¿îµå Ä«µå, Á¶À̽ºÆ½, ±×¸®°í ¸®´ª½º ¹Ú½º ^^
ldp¿¡ ¾Ï¸¸ µÚººÁµÎ ¾ø½À´Ï´Ù. ÀÌ¹Ì Ä¿³Î¹®¼¿¡ Æ÷ÇԵǾî ÀÖ¾î¼ ±×·±°Ô
¾Æ´Ñ°¡ ½Í³×¿ä.
/usr/src/linux/Documentation/joystick.txt¿¡ º¸¸é ¾ÆÁÖ »ó¼¼È÷ ³ª¿Í ÀÖ½À´Ï´Ù.
but, ¿ï³ª¶ó ±¹¹ÎµéÀÌ ¿µ¾î¿¡ ¾àÇѺеéÀÌ ¸¹¾Æ¼, ÀúÀÇ ¹Ì¾àÇÑ ½Ç·ÂÀ¸·Î
Á¦ °æÇè´ã°ú ÇÔ²² ¹¾î¼ ½±°Ô ¾ê±â Çغ¸µµ·Ï ÇÏ°Ú½À´Ï´Ù.
ÀÏ´Ü Ä¿³Î¿¡ Á¶À̽ºÆ½ ¸ðµâÀÌ ÄÄÆÄÀÏ µÇ¾îÀÖ´ÂÁö º¾´Ï´Ù.
Á¶À̽ºÆ½ ¸ðµâÀÌ µé¾îÀÖ´Â µð·ºÅ丮´Â /lib/modules/Ä¿³Î¹öÁ¯/misc¿¡ ÀÖ½À´Ï´Ù
À̸§Àº joy·Î ½ÃÀÛÇÏ´Â ÆÄÀϵéÀÔ´Ï´Ù.
¾øÀ¸¸é Ä¿³ÎÀ» ´Ù½Ã ÄÄÆÄÀÏ ÇÏ½Ã¸é µË´Ï´Ù. (Ä¿³Î ÄÄÆÄÀÏ¿¡ ´ëÇؼ´Â »ý·«ÇÏ°Ú½À´Ï´Ù.) ÆÄÀÏ À̸§µéÀ» º¸½Ã¸é ¾Æ½Ã°ÚÁö¸¸ joy-½ºÆ½À̸§ ÀÔ´Ï´Ù.. ¸¸¾à ÇØ´çÇÏ´Â ½ºÆ½ÀÌ ÀÖ´Ù¸é ¸î¸î±âÁ¾À» Á¦¿ÜÇÏ°í´Â ¹Ù·Î ÀâÈù´Ù°í ¹®¼¿¡ ³ª¿ÍÀÖ½À´Ï´Ù.
±×³É ´Ü¼øÈ÷ modprobe ¸ðµâÀ̸§ ÇÏ½Ã¸é µË´Ï´Ù
modprobe joy-sidewinder
ÀÌ·±½ÄÀ¸·Î ¸»ÀÌÁÒ.
ÇÏÁö¸¸ ÀÌ·¸°Ô ºñ½Ñ ½ºÆ½À» »ç¿ëÇÏ´Â °¡³ÇÑ ¸®´ª¼ºÐµéÀº ¾øÀ»µí ÇÕ´Ï´Ù.
°¡ÀåÀϹÝÀûÀ¸·Î ¸¹ÀÌ ¾²ÀÌ´Â°Ô joy-analog ¿Í joy-pci ÀÔ´Ï´Ù.
joy-analog´Â º¸Åë »çºí°è¿ÀÇ »ç¿îµåÄ«µå¿¡ ½Î±¸·Á Á¶À̽ºÆ½À» »ç¿ëÇÒ¶§ ÀÌ°É ¾²½Ã¸é µÇ±¸ joy-pci´Â pci»ç¿îµåÄ«µå(Æ®¶óÀÌ´øÆ® 4wave, ¿À¸®¾ó º¸Åؽºµîµî)¿¡¼ ½Î±¸·Á Á¶À̽ºÆ½À» »ç¿ëÇÒ ¶§ ¾²¸é µË´Ï´Ù.
ÇÏÁö¸¸ ±×³É Çؼ´Â Á¦´ë·Î ÀâÈ÷Áö ¾Ê½À´Ï´Ù.
Á¶À̽ºÆ½ÀÇ Á¾·ù°¡ ¿ö³« ´Ù¾çÇؼÁÒ..
2Ãà,3Ãà 2¹öÆ°,4¹öÆ°,8¹öÆ°, °Ô´Ù°¡ ½º·ÎƲ ±îÁö.. ±×¿¡ µû¶ó Àû´çÇÑ ¿É¼ÇÀ» ³Ö¾î¾ß ÇÕ´Ï´Ù.
¿ì¸®°¡ °íÄ¥°÷Àº ´ç¿¬È÷ conf.modulesÀÔ´Ï´Ù.
ÀúÀÇ ¼³Á¤Àº ÀÌ·¸°Ô µÇ¾î ÀÖ½À´Ï´Ù.
alias char-major-15 joy-analog
options joy-analog js_an=0x201,12531,0
¿©±â¿¡¼ Áß¿äÇÑ°ÍÀº 12531À̶ó´Â ¼ýÀÚ ÀÔ´Ï´Ù.
ÀÌ ¼ýÀÚ°¡ Ä¿³Î¿¡ ÀÌ Á¶À̽ºÆ½ÀÌ ¹öÆ°¸î°³°¡ ÀÖ°í ÃàÀÌ ¸î°³°¡ ÀÖ°í µîµîÀ» Àü´ÞÇÏ´Â Àμö°¡ µË´Ï´Ù.
ÀÌ ¼ýÀÚ¸¸ ¸¸µå´Â ¹æ¹ýÀ» ¾Ë°í ÀÖÀ¸¸é ÀÌ ¹®¼ÀÇ ÇÙ½ÉÀ» Çϴ°ÍÀÌ µË´Ï´Ù.
Ä¿³Î¹®¼¿¡ ÀÇÇÏ¸é ´ÙÀ½°ú °°½À´Ï´Ù
Bit | 2^n | Meaning
----------------------------------
0 |
1 | Axis X1 (1Ãà)
1 |
2 | Axis Y1 (2Ãà)
2 |
4 | Axis X2 (3Ãà)
3 |
8 | Axis Y2 (4Ãà)
4 |
16 | Button A (1¹öÆ°)
5 |
32 | Button B (2¹öÆ°)
6 |
64 | Button C (3¹öÆ°)
7 |
128 | Button D (4¹öÆ°)
8 |
256 | CHF Buttons X and Y
9 |
512 | CHF Hat 1
10 | 1024 |
CHF Hat 2
11 | 2048 |
FCS Hat
12 | 4096 |
Pad Button X (5¹öÆ°)
13 | 8192 |
Pad Button Y (6¹öÆ°)
14 | 16384 | Pad Button
U (7¹öÆ°)
15 | 32768 | Pad Button
V (8¹öÆ°)
ÀúÀÇ Á¶À̽ºÆ½ °°Àº °æ¿ì¿¡´Â 2Ãà 6¹öÆ° ÀÔ´Ï´Ù.
°è»êÀº ´ÙÀ½°ú °°ÀÌ ÇÕ´Ï´Ù
1Ãà+2Ãà+1¹öÆ°+2¹öÆ°+3¹öÆ°+4¹öÆ°+5¹öÆ°+6¹öÆ°
= 0x0001+0x0002+0x0010+0x0020+0x0040+0x0080+0x1000+0x2000
=0x30F3 = 12531
0x´Â 16Áø¼ö¸¦ °¡¸£Åµ´Ï´Ù. ¹°·Ð Àμö·Î 10Áø¼ö ¸»°íµµ 16Áø¼ö·Îµµ °¡´ÉÇÕ´Ï´Ù.
¸¸¾à 2Ãà 4¹öÆ°À̸é 4¹öÆ°±îÁö¸¸ °è»êÇÏ¸é µÇ°ÚÁÒ.
1Ãà+2Ãà+1¹öÆ°+2¹öÆ°+3¹öÆ°+4¹öÆ°
= 0x0001+0x0002+0x0010+0x0020+0x0040+0x0080
=0x00F3 = 243 ÀÌ µË´Ï´Ù.
ÀÚ. ÀÌÁ¦ ÀÌ°ÍÀ» conf.modules¿¡ Æ÷ÇÔ½Ãŵ´Ï´Ù.
alias char-major-15 joy-analog
options joy-analog js_an=0x201,0x30f3,0
¸Ç¾ÕÀº Á¶À̽ºÆ½ µð¹ÙÀ̽º¸¦ ¾ó¶óÀÌ½Ì Çϴ°ÍÀÔ´Ï´Ù.
/dev/js*¸¦ º¸¸é ¾Æ½Ã°ÚÁö¸¸
µð¹ÙÀ̽º ³ëµå°¡ ij¸¯ÅÍ µð¹ÙÀ̽ºÀÇ ¸ÞÀÌÀú¼ýÀÚ°¡ 15·Î µÇ¾îÀÖ½À´Ï´Ù.
ÀÌ µð¹ÙÀ̽º¿¡ ¾ï¼¼½º ÇÒ·Á°í Çϸé ÀÚµ¿À¸·Î ¸ðµâÀ» ¶ç¿î´Ù´Â ¶æÀÌÁÒ.
±×´ÙÀ½¿¡´Â ÀÌ ¸ðµâÀ» ¶ç¿ï¶§ ´ÙÀ½°ú °°Àº ¿É¼Ç(ÀÎÀÚ)¸¦ ³Ö¾î ÁÝ´Ï´Ù.
ÀÎÀڷδ ÀÌ°ÍÀº ¾Æ³¯·Î±× Á¶À̽ºÆ½À̹ǷΠjs_anÀ̶ó´Â À̸§ÀÌ µé¾î°¡°í ±×µÚ¿¡ Á¶À̽ºÆ½Æ÷Æ®ÀÌ ioÁÖ¼Ò, À§¿¡¼ ½ÇÄÆ ¼³¸íÇÑ Á¶À̽ºÆ½ÀÎÀÚ, ±×¸®°í Á¤Ã¼ºÒ¸íÀÇ 0À̶ó´Â ¼ýÀÚ°¡ µé¾î°¡ ÀÖ½À´Ï´Ù(¾Æ½Ã´ÂºÐ ÀÖÀ¸¸é ¿¬¶ôÁÖ¼¼¿ä ^^)
¸¸¾à Á¶À̽ºÆ½ÀÌ 2°³À̸é
options joy-analog js_an=0x201,0x30f3,0,0x202,0x00f3,0
ÀÌ·±½ÄÀ¸·Î °è¼Ó ¿¬°áÇØÁÖ¸é µË´Ï´Ù ¹°·Ð °°Àº ¾Æ³¯·Î±× Á¶À̽ºÆ½À϶§ÁÒ.
ÀÌ·¸°Ô conf.modules¸¦ ÆíÁýÇÑµÚ ÀúÀåÇÏ°í
modprobe joy-analog
¸¦ ½ÇÇàÇÏ°í³ª¼ lsmod¸¦ Ä¡¸é
[root@ganadist Documentation]# lsmod
Module
Size Used by
joy-analog
4664 0 (unused)
joystick
5852 0 [joy-analog]
°¡ º¸Àϲ®´Ï´Ù.
±×¸®°í Á¤È®ÇÏ°Ô ¼¼ÆõǾú´ÂÁö º¼·Á¸é dmesg·Î Ä¿³Î¸Þ¼¼Áö¸¦ È®ÀÎÇغ¸¸é µË´Ï´Ù.
[root@ganadist Documentation]# dmesg
...................
js: Joystick driver v1.2.15 (c) 1999 Vojtech Pavlik <vojtech@suse.cz>
js0: Analog 2-axis 6-button joystick with XY/UV extensions at 0x201
[TSC timer, 350 MHz clock, 1505 ns res]
¾Æ·¡¿¡ 2Ãà 6¹öÆ°À̶ó°í ÀâÈ÷´Â°Å º¸À̽ÃÁÒ?
¸®´ª½ºÀÇ Á¶À̽ºÆ½ ¸ðµâÀº ¼ö¼¼
¸®´ª½º ¿¡¼ °³¹ßÁßÀÔ´Ï´Ù. °Å±â¼ ¸ðµâÀ» ¹ÞÀ¸½Ã¸é ¸ðµâÀÌ¿Ü¿¡µµ
Á¶À̽ºÆ½ÀÇ ¼³Á¤À» È®ÀÎÇÒ¼ö ÀÖ´Â À¯Æ¿µéÀÌ ÀÖ½À´Ï´Ù.
(¼Ò½º¸¦ ÄÄÆÄÀÏ Çϱâ Èûµå½Ã¸é rpmÀ¸·Î µÈ°ÍÀº ¿©±â¿¡¼
¾òÀ»¼ö ÀÖ½À´Ï´Ù . ²Ù·¯¹Ì¸¦ ¸¸µé¾îÁֽŠȲ»óÁø´Ô²² °¨»ç ^^)
jsattatch, jscal, jstest ÁÒ.
jsattach´Â ½Ã¸®¾ó¶óÀÎÀ¸·Î ºÎÂøµÇ´Â (ºñ½Ñ°Ì´Ï´Ù. -.-a) Á¶À̽ºÆ½µéÀ» ¼¼ÆÃÇÒ¶§ ¾²´Â°Å¶ó´Â±º¿ä.
¿ì¸®°¡ À¯½ÉÈ÷ ºÁ¾ß ÇÒ ºÎºÐÀº jscal°ú jstestÀÔ´Ï´Ù.
jscalÀº Á¶À̽ºÆ½ °¨µµ¸¦ Á¶Àý(calibration¶ó°í ÇÏÁÒ)ÇÏ´Â À¯Æ¿ÀÌ°í jstest´Â ¸» ±×´ë·Î Å×½ºÆ®¸¦ Çغ¼¶§ ¾²ÀÔ´Ï´Ù.
jscal -c /dev/js0 Àº °¨µµ¸¦ ¼¼ÆÃÇÏ´Â °ÍÀÔ´Ï´Ù.
jscal -p /dev/js0Àº ÇöÀç °¨µµ¸¦ Ãâ·ÂÇÏ´Â °ÍÀÔ´Ï´Ù.
¸ÕÀú ¼¼ÆÃÀ» ÇÑ ´ÙÀ½¿¡ -p¿É¼ÇÀ¸·Î ³ª¿À´Â ¹®ÀÚ¸¦ ÆÄÀÏ·Î ÀúÀåÇÕ´Ï´Ù.
[root@ganadist test]# jscal -p /dev/js0
jscal -s 2,1,6,549,551,1020636,985054,1,10,561,567,997871,999729 /dev/js0
¸®´ÙÀÌ·º¼ÇÀ» ÀÌ¿ëÇؼ ÆÄÀÏ·Î ÀúÀåÇÏ¸é µÇ°ÚÁÒ?
[root@ganadist test]# jscal -p /dev/js0 > /etc/joystick.conf
±×´ÙÀ½¿¡ rc.local°°Àº ½ºÅ©¸³Æ®¿¡ ¸Ç ¸¶Áö¸·¿¡ ´ÙÀ½°ú °°ÀÌ ÇØÁÖ¸é..
source /etc/joystick.conf
ÇÏ¸é ºÎÆÃÇÏ¸é¼ ÀÚµ¿À¸·Î ¼¼Æà ³¡³» ÁÖ°ÚÁÒ?
jstest /dev/js0 Çϸé
°¢Ãà°ú ¹öÆ°µéÀ» Å×½ºÆ® Çغ¼¼ö ÀÖ½À´Ï´Ù.
ÀÚ. ÀûÀº±è¿¡ »ÍÀ» »Ì°Ú½À´Ï´Ù. -.-a
makefile.unix¿¡¼ ´ÙÀ½ ºÎºÐÀ» ¼öÁ¤ÇÕ´Ï´Ù.
Input Devices¼½¼Ç¿¡¼ ÁÖ¼®Ã³¸®µÈ ºÎºÐÀ» Áö¿ó´Ï´Ù.
# Select one or more joystick types which you want to use, which one
is
# actually used can be selected runtime with the -joytype switch.
# *** for using X Input Extensions based joystick
# This is known to not work right now ;)
# ( Recommended if available. Of course: doesn't work in SVGALib arch
...)
# You should also declare a default name for input device.
# and choose polling method ( event processing or device polling )
# use provided program "xlistdev" to now available ones
# and dont forget to include library in linker definition !!
JSX11 = -DX11_JOYSTICK
JSNAME = \"Joystick\"
JSPOLL = -DUSE_X11_JOYEVENTS
JSLIB = -lXi
# On iX86 based OS's, if supported, you can use standard joystick driver
JSI386 = -DI386_JOYSTICK
À§´Â ¿¢½ºÀ©µµ¿¡¼ Á¶À̽ºÆ½À» ¼¼ÆÃÇÏ°í³ª¼ »ç¿ëÇϴ°ÍÀ» ¶æÇÏ°í ¾Æ·¡´Â Ä¿³Î¿¡¼ Á¦°øÇÏ´Â ¸ðµâÀ» »ç¿ëÇÏ´Â °ÍÀÔ´Ï´Ù.
±×´ÙÀ½ ÄÄÆÄÀÏÀ» ÇÏ°í³ª¼ xmamerc ¸¦ ¼öÁ¤ÇÕ´Ï´Ù.
# what kind of joystick to use, if any
# 0 No joystick
# 1 i386 style joystick driver (if compiled in)
# 2 Fm Town Pad support (if compiled in)
# 3 X11 input extension joystick (if compiled in)
# 4 new i386 linux 1.x.x joystick driver (if compiled in)
joytype 4
# Is your joystick analog?
analogstick 1
# If using X11 based joystick enter name of joystick device
# Use provided "xlistdev" command, to see which one are availables
# on your system
#x11joyname Joystick
Ä¿³Î 2.2¿¡¼ »ç¿ëµÇ´Â ¸ðµâÀº 4¹ø° ŸÀÔÀ¸·Î ¼³Á¤ ÇÏ¸é µË´Ï´Ù.
(¿©°£ÇÏ¸é ¿¢½º¿¡¼ ¼¼ÆÃÇÏ¿© mameµ¹¸®Áö ¸¶½Ê½Ã¿À ¿ ¹Þ½À´Ï´Ù ^^)
ÀÚ ¼¼Æà ³¡³ª°í xmame¸¦ ½ÇÇàÇϸé Á¶À̽ºÆ½ÀÌ ÀâÇû´Ù°í ¸Þ¼¼Áö°¡ ¶å´Ï´Ù.
[root@ganadist xmame]# xmame.x11
Linux Sound Driver initialization...
Setting fragsize to 4096, numfrags to 5
Fragsize = 4096, Numfrags = 5
Audio device /dev/dsp set to 16bit linear stereo 44100Hz
Mouse/Trakball selected.
Using a Visual with a depth of 16bpp.
MIT-SHM Extension Available. trying to use... Success.
Using Shared Memory Features to speed up
Actual bits per pixel = 16... Ok
I386 joystick interface initialization...
Joystick: /dev/js0 is Analog 2-axis 6-button joystick with XY/UV extensions
Joystick: Built in driver version: 1.2.15
Joystick: Kernel driver version : 1.2.15
OSD: Info: Joystick 0, 2 axis, 6 buttons
width= 256, height = 256, viswidth = 256, visheight = 224,visstartx=
0, visstarty= 16
Game uses 254 colors
XF86Config ÆÄÀÏÀÇ ¸Ç ³¡ºÎºÐ¿¡ ´ÙÀ½°ú °°ÀÌ Ãß°¡ ÇÕ´Ï´Ù.
Section "Module"
Load "xf86Jstk.so"
Load "xie.so"
EndSection
# **********************************************************************
# Input devices
# **********************************************************************
Section "Xinput"
SubSection "Joystick"
Port "/dev/js0"
DeviceName "Joystick"
TimeOut 10
MinimumXPosition 1
MaximumXPosition 255
MinimumYPosition 1
MaximumYPosition 255
CenterX 128
CenterY 128
Delta 20
AlwaysCore
EndSubSection
EndSection
´Ù½Ã ¿¢½º¸¦ ±¸µ¿Çϸé Á¶À̽ºÆ½À» Æ÷ÀÎÅ͵ð¹ÙÀ̽º·Î »ç¿ëÇÒ¼ö ÀÖ½À´Ï´Ù.
(±×³É ½É½ÉÇϸé Çغ¸¼¼¿ä.. ±×¸® ÇÒÁþÀº ¸øµË´Ï´Ù¸¸.. -.-a)
Çغ¸°í³ª´Ï ³²´Â°ÅµÎ ¸¹±º¿ä ^^ (÷À¸·Î awk¶ó´Â°É ½áºÃ½À´Ï´Ù )
===============================
#!/bin/sh
JOY_CONF=/etc/conf.modules
cp -f ${JOY_CONF} ${JOY_CONF}.bak
grep -v joy ${JOY_CONF} > ${JOY_CONF}.tmp
case "${LANG}" in
ko | korean | ko_KR | ko_KR.eucKR )
intro="¾î¶² Á¾·ùÀÇ Á¶À̽ºÆ½À»
°¡Áö°í ÀÖ½À´Ï±î?"
select_item="1) ¾Æ³ª·Î±×
2) PCI 3) ±×¿Ü ±âº»°ª)¾Æ³ª·Î±×"
select_axis="1)1Ãà 2)2Ãà
3)3Ãà 4)4Ãà ±âº»°ª)2Ãà"
select_btn="1)2¹öÆ° 2)4¹öÆ°
3)6¹öÆ° 4)8¹öÆ° ±âº»°ª)4¹öÆ°"
success="" ;;
* )
intro="What type of Joystick
do you have?"
select_item="1) analog 2)
pci 3) etc default)analog"
select_axis="1)1 axis 2)2
axis 3)3 axis 4)4 axis default)2 axis"
select_btn="1)2 button 2)4
button 3)6 button 4)8 button default)4 button" ;;
esac
echo $intro
echo $select_item
read type
case "${type}" in
1 ) JOY_TYPE=analog
SHORT=an;;
2 ) JOY_TYPE=pci
SHORT=pci;;
3 ) ;;
* ) JOY_TYPE=analog
SHORT=an
esac
echo $select_axis
read type
case "${type}" in
1 ) AXIS=1 ;;
2 ) AXIS=3 ;;
3 ) AXIS=7 ;;
4 ) AXIS=15 ;;
* ) AXIS=3
esac
echo $AXIS
echo $select_btn
read type
case "${type}" in
2 ) BTN=240 ;;
3 ) BTN=12528 ;;
4 ) BTN=61680 ;;
* ) BTN=240
esac
echo $BTN
echo "alias char-major-15 joy-${JOY_TYPE}" >> ${JOY_CONF}.tmp
echo "options joy-${JOY_TYPE} js_${SHORT}=0x201,$(($AXIS + $BTN)),0"
>> ${JOY_CONF}.tmp
for MODULE in $(lsmod |grep joy | awk '{ printf("\n"$1) }')
do
rmmod $MODULE
done
mv -f ${JOY_CONF}.tmp ${JOY_CONF}
modprobe joy-${JOY_TYPE}
dmesg | tail -n 2
============================================
Á¶À̽ºÆ½ ÇÏ¿ìÅõ ²ôÀ¸ÀÄ~