特殊:Badtitle/NS100:CWiiD:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
(未显示同一用户的3个中间版本) | |||
第3行: | 第3行: | ||
== Introduction == | == Introduction == | ||
Since the Wii Remote uses bluetooth to communicate with the console, it's relatively straightforward to use it to control a computer. The most obvious way is similar to the main menu on the Wii console - point the remote where you want the cursor to go, and press A and B to left and right click. There are also options for tilting the Wiimote to move the cursor around, which is useful if you don't have a sensor bar available. | Since the Wii Remote uses bluetooth to communicate with the console, it's relatively straightforward to use it to control a computer. The most obvious way is similar to the main menu on the Wii console - point the remote where you want the cursor to go, and press A and B to left and right click. There are also options for tilting the Wiimote to move the cursor around, which is useful if you don't have a sensor bar available. | ||
== Installation == | == Installation == | ||
=== | === Gusty (7.10) to Jaunty (9.04) === | ||
<pre><nowiki> | <pre><nowiki> | ||
sudo apt-get install libcwiid0 lswm wmgui wminput | sudo apt-get install libcwiid0 lswm wmgui wminput | ||
</nowiki></pre> | </nowiki></pre> | ||
=== | === Karmic (9.10) and above === | ||
<pre><nowiki> | <pre><nowiki> | ||
sudo apt-get install | sudo apt-get install libcwiid1 lswm wmgui wminput | ||
</nowiki></pre> | </nowiki></pre> | ||
* Note the change in package name | |||
== Controlling the Wii Remote == | == Controlling the Wii Remote == | ||
Now it's possible to load a gui which shows what the Wiimote is doing: | Now it's possible to load a gui which shows what the Wiimote is doing: | ||
第69行: | 第24行: | ||
sudo modprobe uinput | sudo modprobe uinput | ||
</nowiki></pre> | </nowiki></pre> | ||
or | or uinput can be put into /etc/modules: | ||
<pre><nowiki> | <pre><nowiki> | ||
gksudo gedit /etc/ | gksudo gedit /etc/modules | ||
</nowiki></pre> | </nowiki></pre> | ||
Mine looks like this: | |||
<pre><nowiki> | <pre><nowiki> | ||
# | # /etc/modules: kernel modules to load at boot time. | ||
# | # | ||
# This file contains the names of kernel modules that should be loaded | |||
# at boot time, one per line. Lines beginning with "#" are ignored. | |||
# This | |||
# | |||
# | |||
lp | |||
uinput | |||
</nowiki></pre> | </nowiki></pre> | ||
=== | === Using remote as mouse === | ||
Now, we can start using the Wiimote to control the mouse. First, find the address of the Wiimote (this is optional, but speeds up connecting). Press 1+2 on the Wiimote and run: | Now, we can start using the Wiimote to control the mouse. First, find the address of the Wiimote (this is optional, but speeds up connecting). Press 1+2 on the Wiimote and run: | ||
<pre><nowiki> | <pre><nowiki> | ||
第101行: | 第47行: | ||
Press the 1+2 buttons on the Wiimote and run: | Press the 1+2 buttons on the Wiimote and run: | ||
<pre><nowiki> | <pre><nowiki> | ||
wminput 00:1F:32:95:EF:B0 | sudo wminput 00:1F:32:95:EF:B0 | ||
</nowiki></pre> | </nowiki></pre> | ||
replacing 00:1F:32:95:EF:B0 with the address of your Wiimote. This can be run without the address, but will take longer to connect. | replacing 00:1F:32:95:EF:B0 with the address of your Wiimote. This can be run without the address, but will take longer to connect. | ||
第120行: | 第66行: | ||
wminput -c ir_ptr 00:1F:32:95:EF:B0 | wminput -c ir_ptr 00:1F:32:95:EF:B0 | ||
</nowiki></pre> | </nowiki></pre> | ||
== Other notes == | == Other notes == | ||
It's worth noting that if the Wii is turned off, so is the sensor bar, so you have to have it turned on. This means that if your Wiimotes are paired with your console, when you press 1 and 2, they'll automatically link to the console, rather than your computer. I'm currently working round this by pressing the red button under the battery cover instead of 1 and 2 to enter discoverable mode. I'm planning to go and pair one of my Wiimotes with someone else's console, so I won't have to do that. | It's worth noting that if the Wii is turned off, so is the sensor bar, so you have to have it turned on. This means that if your Wiimotes are paired with your console, when you press 1 and 2, they'll automatically link to the console, rather than your computer. I'm currently working round this by pressing the red button under the battery cover instead of 1 and 2 to enter discoverable mode. I'm planning to go and pair one of my Wiimotes with someone else's console, so I won't have to do that. | ||
第158行: | 第72行: | ||
There are a number of companies selling various Wii accessories, such as replacement sensor bars, which could be used, however I plan to buy some IR LEDs and mount them on my laptop, and connect them to a USB port. | There are a number of companies selling various Wii accessories, such as replacement sensor bars, which could be used, however I plan to buy some IR LEDs and mount them on my laptop, and connect them to a USB port. | ||
== Config files == | == Config files == | ||
If you want to change the config files, they're in <code><nowiki> | If you want to change the config files, they're in <code><nowiki>/etc/cwiid/wminput</nowiki></code> - it'll load <code><nowiki>default</nowiki></code> unless something else is specified. After install, default is linked to <code><nowiki>acc_ptr</nowiki></code>, so the acclerometers control the pointer. buttons contains the mappings for the buttons to keys, and is linked by the other config files. I've made a new config file, which is basically a copy/paste from <code><nowiki>buttons</nowiki></code> and <code><nowiki>ir_ptr</nowiki></code>: | ||
<pre><nowiki> | <pre><nowiki> | ||
#IR pointer | #IR pointer | ||
第205行: | 第119行: | ||
I'd like to have a better way to reload xorg.conf than restarting X - especially for a howto that's being followed from a webpage! | I'd like to have a better way to reload xorg.conf than restarting X - especially for a howto that's being followed from a webpage! | ||
The keymappings in the config file don't work sensibly. The key mappings given don't map to the keys they claim to. | The keymappings in the config file don't work sensibly. The key mappings given don't map to the keys they claim to. | ||
---- | ---- | ||
[[category: | [[category:CategoryBluetooth]] [[category:CategoryGames]] [[category:CategoryHardware]] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2010年5月19日 (三) 21:58的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/CWiiD }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/af | • {{#if: UbuntuHelp:CWiiD|Afrikaans| [[::CWiiD/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ar | • {{#if: UbuntuHelp:CWiiD|العربية| [[::CWiiD/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/az | • {{#if: UbuntuHelp:CWiiD|azərbaycanca| [[::CWiiD/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/bcc | • {{#if: UbuntuHelp:CWiiD|جهلسری بلوچی| [[::CWiiD/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/bg | • {{#if: UbuntuHelp:CWiiD|български| [[::CWiiD/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/br | • {{#if: UbuntuHelp:CWiiD|brezhoneg| [[::CWiiD/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ca | • {{#if: UbuntuHelp:CWiiD|català| [[::CWiiD/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/cs | • {{#if: UbuntuHelp:CWiiD|čeština| [[::CWiiD/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/de | • {{#if: UbuntuHelp:CWiiD|Deutsch| [[::CWiiD/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/el | • {{#if: UbuntuHelp:CWiiD|Ελληνικά| [[::CWiiD/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/es | • {{#if: UbuntuHelp:CWiiD|español| [[::CWiiD/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/fa | • {{#if: UbuntuHelp:CWiiD|فارسی| [[::CWiiD/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/fi | • {{#if: UbuntuHelp:CWiiD|suomi| [[::CWiiD/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/fr | • {{#if: UbuntuHelp:CWiiD|français| [[::CWiiD/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/gu | • {{#if: UbuntuHelp:CWiiD|ગુજરાતી| [[::CWiiD/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/he | • {{#if: UbuntuHelp:CWiiD|עברית| [[::CWiiD/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/hu | • {{#if: UbuntuHelp:CWiiD|magyar| [[::CWiiD/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/id | • {{#if: UbuntuHelp:CWiiD|Bahasa Indonesia| [[::CWiiD/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/it | • {{#if: UbuntuHelp:CWiiD|italiano| [[::CWiiD/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ja | • {{#if: UbuntuHelp:CWiiD|日本語| [[::CWiiD/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ko | • {{#if: UbuntuHelp:CWiiD|한국어| [[::CWiiD/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ksh | • {{#if: UbuntuHelp:CWiiD|Ripoarisch| [[::CWiiD/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/mr | • {{#if: UbuntuHelp:CWiiD|मराठी| [[::CWiiD/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ms | • {{#if: UbuntuHelp:CWiiD|Bahasa Melayu| [[::CWiiD/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/nl | • {{#if: UbuntuHelp:CWiiD|Nederlands| [[::CWiiD/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/no | • {{#if: UbuntuHelp:CWiiD|norsk| [[::CWiiD/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/oc | • {{#if: UbuntuHelp:CWiiD|occitan| [[::CWiiD/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/pl | • {{#if: UbuntuHelp:CWiiD|polski| [[::CWiiD/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/pt | • {{#if: UbuntuHelp:CWiiD|português| [[::CWiiD/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ro | • {{#if: UbuntuHelp:CWiiD|română| [[::CWiiD/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/ru | • {{#if: UbuntuHelp:CWiiD|русский| [[::CWiiD/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/si | • {{#if: UbuntuHelp:CWiiD|සිංහල| [[::CWiiD/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/sq | • {{#if: UbuntuHelp:CWiiD|shqip| [[::CWiiD/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/sr | • {{#if: UbuntuHelp:CWiiD|српски / srpski| [[::CWiiD/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/sv | • {{#if: UbuntuHelp:CWiiD|svenska| [[::CWiiD/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/th | • {{#if: UbuntuHelp:CWiiD|ไทย| [[::CWiiD/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/tr | • {{#if: UbuntuHelp:CWiiD|Türkçe| [[::CWiiD/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/vi | • {{#if: UbuntuHelp:CWiiD|Tiếng Việt| [[::CWiiD/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/yue | • {{#if: UbuntuHelp:CWiiD|粵語| [[::CWiiD/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/zh | • {{#if: UbuntuHelp:CWiiD|中文| [[::CWiiD/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/zh-hans | • {{#if: UbuntuHelp:CWiiD|中文(简体)| [[::CWiiD/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CWiiD | UbuntuHelp:CWiiD | {{#if: | :}}CWiiD}}/zh-hant | • {{#if: UbuntuHelp:CWiiD|中文(繁體)| [[::CWiiD/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:CWiiD|:CWiiD|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :CWiiD/zh | | {{#ifexist: CWiiD/zh | | {{#ifeq: {{#titleparts:CWiiD|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:CWiiD|1|-1|}} | zh | | }}
Introduction
Since the Wii Remote uses bluetooth to communicate with the console, it's relatively straightforward to use it to control a computer. The most obvious way is similar to the main menu on the Wii console - point the remote where you want the cursor to go, and press A and B to left and right click. There are also options for tilting the Wiimote to move the cursor around, which is useful if you don't have a sensor bar available.
Installation
Gusty (7.10) to Jaunty (9.04)
sudo apt-get install libcwiid0 lswm wmgui wminput
Karmic (9.10) and above
sudo apt-get install libcwiid1 lswm wmgui wminput
- Note the change in package name
Controlling the Wii Remote
Now it's possible to load a gui which shows what the Wiimote is doing:
wmgui
Select "connect" from the file menu, press 1+2 when prompted then OK. Lights and rumble can be turned on and off from the controls menu, and which inputs are displayed from the settings menu. Using this, you can test the IR camera, the accelerometers and check the inputs from the Nunchuck or Classic Controller. Next up is the mouse "emulator" which allows you to control the mouse with the Wiimote. At this point, it can be run with default settings (tilting the Wiimote moves the pointer, A and B work as left and right click). The uinput module needs to be loaded into the kernal first. This can either be done manually after every reboot:
sudo modprobe uinput
or uinput can be put into /etc/modules:
gksudo gedit /etc/modules
Mine looks like this:
# /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. lp uinput
Using remote as mouse
Now, we can start using the Wiimote to control the mouse. First, find the address of the Wiimote (this is optional, but speeds up connecting). Press 1+2 on the Wiimote and run:
lswm
This should return the address of the Wiimote (something like 00:1F:32:95:EF:B0). This will be different for each Wiimote. If it doesn't work, try again, ensuring the lights on the Wiimote are still flashing when you run lswm.
Moving the mouse by tilting the Wiimote
Press the 1+2 buttons on the Wiimote and run:
sudo wminput 00:1F:32:95:EF:B0
replacing 00:1F:32:95:EF:B0 with the address of your Wiimote. This can be run without the address, but will take longer to connect.
Moving the mouse by pointing the Wiimote at an IR source
gksudo gedit /etc/cwiid/wminput/ir_ptr
Find these lines:
Plugin.ir_ptr.X = ~ABS_X Plugin.ir_ptr.Y = ~ABS_Y
and replace them with:
Plugin.ir_ptr.X = ABS_X Plugin.ir_ptr.Y = ABS_Y
Press 1+2 on the Wiimote and from a terminal run this:
wminput -c ir_ptr 00:1F:32:95:EF:B0
Other notes
It's worth noting that if the Wii is turned off, so is the sensor bar, so you have to have it turned on. This means that if your Wiimotes are paired with your console, when you press 1 and 2, they'll automatically link to the console, rather than your computer. I'm currently working round this by pressing the red button under the battery cover instead of 1 and 2 to enter discoverable mode. I'm planning to go and pair one of my Wiimotes with someone else's console, so I won't have to do that.
Sensor bar alternatives
Since the sensor bar consists of a number of IR LEDs (in two groups, one at each end of the bar), which the Wii remote detects as two dots, it's relatively easy to make an alternative sensor bar for use away from the Wii. Ideally, you want two IR point sources, such as IR LEDs, however candles, lighters, light bulbs etc will work as well. Also, CWiiD only actually requires a single point to track, so it is possible to just point the remote at a room light, and track from that. There are a number of companies selling various Wii accessories, such as replacement sensor bars, which could be used, however I plan to buy some IR LEDs and mount them on my laptop, and connect them to a USB port.
Config files
If you want to change the config files, they're in /etc/cwiid/wminput
- it'll load default
unless something else is specified. After install, default is linked to acc_ptr
, so the acclerometers control the pointer. buttons contains the mappings for the buttons to keys, and is linked by the other config files. I've made a new config file, which is basically a copy/paste from buttons
and ir_ptr
:
#IR pointer Plugin.ir_ptr.X = ~ABS_X Plugin.ir_ptr.Y = ~ABS_Y #buttons Wiimote.A = BTN_LEFT Wiimote.B = BTN_RIGHT Wiimote.Up = KEY_KATAKANA Wiimote.Down = KEY_KPENTER Wiimote.Left = KEY_HENKAN Wiimote.Right = KEY_MUHENKAN Wiimote.Minus = KEY_BACK Wiimote.Plus = KEY_FORWARD Wiimote.Home = KEY_HOME Wiimote.1 = KEY_SLASH Wiimote.2 = KEY_SPACE #Nunchuk.C = BTN_LEFT #Nunchuk.Z = BTN_RIGHT # #Classic.Up = KEY_UP #Classic.Down = KEY_DOWN #Classic.Left = KEY_LEFT #Classic.Right = KEY_RIGHT #Classic.Minus = KEY_BACK #Classic.Plus = KEY_FORWARD #Classic.Home = KEY_HOME #Classic.A = BTN_LEFT #Classic.B = BTN_RIGHT #Classic.X = #Classic.Y = #Classic.ZL = #Classic.ZR = #Classic.L = #Classic.R =
But I'm currently having a few problems with it. The up/down/left/right maps aren't assigned sensibly - hence the rather odd bindings, however these values seem to work. The right click has also stopped working, despite not changing anything relating to it in the config file.
There is a file in with the source ~/Wii/cwiid-0.5.03/wminput/action_enum.txt
which should contain all the codes for keys, however it seems to be significantly out - at least for a GB keyboard.
Problems
There are a few things I'm not quite happy with here. I'd like to find a way to disassociate my controllers from my console, so that they don't automatically link to it whenever it's on. I'd like to have a better way to reload xorg.conf than restarting X - especially for a howto that's being followed from a webpage! The keymappings in the config file don't work sensibly. The key mappings given don't map to the keys they claim to.