个人工具

“UbuntuHelp:SerialMouseHowto”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第3行: 第3行:
 
If you are installing on a PC with a mouse attached to a serial port (rather than the mouse port), here's what you need to do...
 
If you are installing on a PC with a mouse attached to a serial port (rather than the mouse port), here's what you need to do...
  
== Using Inputattach ==
+
== Manual editing of the xorg.conf file ==
  
1. Press Control-Alt-F1 to get to Virtual Terminal 1 (your screen will turn black and you'll see a login prompt in white text).
+
This is arguably the simplest method to set up a serial mouse.
  
2. Login using your username and password.
+
* Boot up normally and wait for Ubuntu to finish loading.
  
3. [only for releases prior to 6.06/Dapper] Install the 'joystick' package by running 'apt-get install joystick'
+
* Press '''Ctrl+Alt+F1''' to gain access to a text console (your screen will turn black with a prompt in white text, and if not running from the CD you may be asked to login).
  
4. Run 'inputattach --help' and find the appropriate protocol option to match your mouse
+
* Type the following exactly:
 +
<pre><nowiki>
 +
sudo nano -B /etc/X11/xorg.conf
 +
</nowiki></pre>
  
5. Add 'inputattach <protocol option> /dev/ttyS0' (or whatever device your serial mouse is attached to) to /etc/rc.local
+
* If you have one, you will be asked for your user password.
  
6. Restart
+
* The editor will open, displaying the xorg.conf file.
  
7.  Hopefully your mouse is now working, if not, remove the line you added to rc.local and try another method.
+
* Navigate (using the arrow and/or Page Up/Down keys) to the following section:
 +
<pre><nowiki>
 +
Section "InputDevice"
 +
Identifier "Configured Mouse"
 +
Driver "mouse"
 +
Option "CorePointer"
 +
Option "Device" "/dev/input/mice"
 +
Option "Protocol" "ExplorerPS/2"
 +
Option "ZAxisMapping" "4 5"
 +
Option "Emulate3Buttons" "true"
 +
EndSection
 +
</nowiki></pre>
  
== Configure xserver (alternate method) ==
+
* Change the "Option Device" and "Option Protocol" lines as follows:
 +
<pre><nowiki>
 +
Section "InputDevice"
 +
Identifier "Configured Mouse"
 +
Driver "mouse"
 +
Option "CorePointer"
 +
Option "Device" "/dev/ttyS0"
 +
Option "Protocol" "auto"
 +
Option "ZAxisMapping" "4 5"
 +
EndSection
 +
</nowiki></pre> change ttyS0 to ttyS1 if your mouse is connected to COM2 instead of COM1.
  
The installation will complete, and you will be able to log in but your mouse will not move or respond to button clicks. You need to reconfigure your xserver to see the mouse.
+
* Type '''Ctrl+X''' then '''Y''' and '''Enter''' to save the changes to the file and exit.
  
* Press Control-Alt-F1 to get to Virtual Terminal 1 (your screen will turn black and you'll see a login prompt in white text).
+
* Press '''Ctrl+Alt+F7''' (to return to the graphical interface).
  
* Login using your username and password.
+
* Press '''Ctrl+Alt+Backspace''' ('''NOT''' Delete!) to restart the graphical interface.
 +
 
 +
* Hopefully your mouse now works. If not, type the following to undo your changes, just to be safe, before trying again using ttyS1 instead of ttyS0.
  
* Enter the following command at the prompt
 
 
<pre><nowiki>
 
<pre><nowiki>
sudo dpkg-reconfigure xserver-xorg
+
cd /etc/X11
 +
sudo cp xorg.conf~ xorg.conf
 
</nowiki></pre>
 
</nowiki></pre>
  
* Press Return to accept the existing settings UNTIL you get to the selection for the mouse port.
+
(Note the symbol immediately after the first "xorg.conf" is a tilde. The error message '''cp: cannot stat...''' indicates a typing error here.)
  
* Choose whichever port your mouse is connected to:
+
If trying the other port also fails try another method below.
  
* first serial port: /dev/ttyS0
 
* second serial port: /dev/ttyS1
 
  
* Press Return to accept each the rest of the settings pages.
+
=== Manual editing of the xorg.conf file (without leaving graphical mode) ===
  
* After you finish configuring the xserver, you will get back to a prompt in white text on a black background.
+
How to set up a serial mouse using only the keyboard and without working in a text-only console.
  
* Switch back to the xserver by pressing Control-Alt-F7 (virtual terminal 7).
+
It is highly recommended that you make a backup copy of the "xorg.conf" file before making edits.
  
* Kill the xserver by pressing Control-Alt-Backspace (This is NOT Control-Alt-Delete, which will make the machine shutdown).
+
* Login normally and wait for Ubuntu to finish loading.
  
* When the xserver restarts, your mouse should work normally. If not, you may have chosen the wrong port. If necessary, press Control-Alt-F1 to go back to the virtual terminal and reconfigure the xserver again (following the steps above). If the xserver gives up, you can make it try again by typing startx at a virtual terminal prompt.
+
* Press '''"Alt+F1"''', to open the '''"Applications"''' menu.
  
== Installing Without a Mouse At All. ==
+
* Press '''down arrow''' to move to the '''"Accessories"''' item.
  
This method will help you if you MUST install Ubuntu on a pc with a serial mouse. Clearly you cant modify xorg.conf when running from the CD, so you CAN'T have a mouse during the installation process.
+
* Press '''right arrow''' to get into the next '''"menu"'''.
  
1) Exit Xorg
+
* Press '''down arrow''' to move to the '''"Terminal"''' item.
2) Create an .xinitrc file in your home directory, with the following line.
+
  
xterm -geometry +300+300
+
* Press '''Enter/Return''' to start a '''small terminal window'''.
  
3) Save the file and run startx
+
* Type in '''"gksudo gedit /etc/X11/xorg.conf"''' and press '''Enter/Return'''.
  
Now you will have an X session. with a focused XTERM in the middle of your screen. Just type
+
* When asked, enter your '''password''' and press '''Enter/Return''' (gedit will open, displaying the xorg.conf file).
  
sudo ubiquity
+
*** Using the keyboard, navigate to '''"Configured Mouse"'''.
  
And follow the installation procedure using only your keyboard.
+
*** Change '''"/dev/input/mice"''' to '''"/dev/ttyS0"''' (or '''"/dev/ttyS1"''' if using COM2 instead of COM1)
  
 +
*** Change '''"ExplorerPS/2"''' to '''"Auto"'''
  
 +
* Press '''"Ctrl+s"''' to save the changes.
  
[[category:CategoryCleanup]]
+
* Press '''"Ctrl+q"''' to close the editor.
  
== Installing Without a Mouse 2 ==
+
* Press '''"Ctrl+Alt+Backspace"''' to restart the X server.
  
1) Boot from CD
+
Your mouse should work at this point, if it doesn't, restart the system.
  
2) Press Alt+F1, and search from "Applications" menu the termianal with the arrow buttons
 
  
3) Enter "sudo ubiquity"
+
== Using Inputattach ==
  
4) Than you get the install window. Here you can set the language, the keyboard, your name and the
+
* Press Control-Alt-F1 to get to Virtual Terminal 1 (your screen will turn black and you'll see a login prompt in white text).
boot-harddisk drive for the installation with the arrow and TAB buttons. (You can't set date and
+
time, but it will be possible later too...)
+
  
5) If your installation is ready reboot...
+
* Login using your username and password.
  
6) Press Ctrl+Alt+F1 to get a terminal interface
 
  
7) Log in with your username and password
+
* Run 'inputattach --help' and find the appropriate protocol option to match your mouse
  
8) Enter "sudo bash" and retype your password (now you are root...)
+
* Add 'inputattach <protocol option> /dev/ttyS0' (or whatever device your serial mouse is attached to) to /etc/rc.local
  
9) Enter "cd /etc/X11" (big X !!)
+
* Restart
  
10) Enter "pico xorg.conf" you get a text editor with a file witch contents configurations for the graphical interface. Here you have to search the part of mouse (arrow buttons...)
+
* Hopefully your mouse is now working, if not, remove the line you added to rc.local and try another method.
  
11) you have to correct two rows:
+
== Configure Xserver (alternate method) ==
  
Protocol "auto"
+
The installation will complete, and you will be able to log in but your mouse will not move or respond to button clicks. You need to reconfigure your xserver to see the mouse.
  
Option Device "/dev/ttyS0" (it is your first serial port)
+
* Press Control-Alt-F1 to get to Virtual Terminal 1 (your screen will turn black and you'll see a login prompt in white text).
  
12) save, exit
+
* Login using your username and password.
  
13) Press Ctrl+Alt+F7 (now you will turn back to graphical interface)
+
* Enter the following command at the prompt
 +
<pre><nowiki>
 +
sudo dpkg-reconfigure xserver-xorg
 +
</nowiki></pre>
  
14) Press Ctrl+Alt+Backspace (and NOT del) to restart the graphical interface
+
* Press Return to accept the existing settings UNTIL you get to the selection for the mouse port.
  
15) hopefully your mouse works. if not, you have to switch to terminal mode and correct xorg.conf so:
+
* Choose whichever port your mouse is connected to:
  
"/dev/ttyS0" will change to "/dev/ttyS1" (it is your second serial port...)
+
* first serial port: /dev/ttyS0
 +
* second serial port: /dev/ttyS1
  
 +
* Press Return to accept each the rest of the settings pages.
  
== Manual editing of the xorg.conf file ==
+
* After you finish configuring the xserver, you will get back to a prompt in white text on a black background.
  
This may be the most direct method to set up a serial mouse.
+
* Switch back to the xserver by pressing Control-Alt-F7 (virtual terminal 7).
  
In a console, navigate to /etc/X11
+
* Kill the xserver by pressing Control-Alt-Backspace (This is NOT Control-Alt-Delete, which will make the machine shutdown).
  
<pre><nowiki>
+
* When the xserver restarts, your mouse should work normally. If not, you may have chosen the wrong port. If necessary, press Control-Alt-F1 to go back to the virtual terminal and reconfigure the xserver again (following the steps above). If the xserver gives up, you can make it try again by typing startx at a virtual terminal prompt.
cd /etc/X11
+
</nowiki></pre>
+
  
There you can use an editor to manually edit the file xorg.conf
+
== Installing Without a Mouse At All. ==
You will need to do this as root. vi is a commonly used editor.
+
  
<pre><nowiki>
+
This method will help you if you MUST install Ubuntu on a pc with a serial mouse. Clearly you cant modify xorg.conf when running from the CD, so you CAN'T have a mouse during the installation process.
sudo <editor_of_choice> xorg.conf
+
</nowiki></pre>
+
 
+
You will be asked for your user password. Once given, the
+
editor will open, displaying the xorg.conf file.
+
 
+
Navigate to the following section:
+
  
 +
* Exit the xserver
 +
* Create an .xinitrc file in your home directory, with the following line.
 
<pre><nowiki>
 
<pre><nowiki>
Section "InputDevice"
+
xterm -geometry +300+300
Identifier "Configured Mouse"
+
Driver "mouse"
+
Option "CorePointer"
+
Option "Device" "/dev/input/mice"
+
Option "Protocol" "ExplorerPS/2"
+
Option "ZAxisMapping" "4 5"
+
Option "Emulate3Buttons" "true"
+
EndSection
+
 
</nowiki></pre>
 
</nowiki></pre>
 +
* Save the file and run startx
  
Change the "Option Device" and "Option Protocol" lines as follows:
+
* Now you will have an X session. with a focused XTERM in the middle of your screen. Just type:  
 
+
 
<pre><nowiki>
 
<pre><nowiki>
Section "InputDevice"
+
sudo ubiquity
Identifier "Configured Mouse"
+
</nowiki></pre> And follow the installation procedure using only your keyboard.
Driver "mouse"
+
Option "CorePointer"
+
Option "Device" "/dev/ttyS0"
+
Option "Protocol" "Microsoft"
+
Option "ZAxisMapping" "4 5"
+
EndSection
+
</nowiki></pre>
+
  
ttyS0 might need to be ttyS1 on your system, depending on which
 
COM port your mouse is plugged into.
 
  
Save your changes (be sure to make a backup first). To get these
+
----
changes to take affect, you will now need to restart your X server.
+
[[category:CategoryCleanup]]
This is done with "Ctrl-Alt-Backspace"
+
 
+
If that doesn't do it, you can always try a reboot of the system.
+
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月21日 (三) 18:05的版本

If you are installing on a PC with a mouse attached to a serial port (rather than the mouse port), here's what you need to do...

Manual editing of the xorg.conf file

This is arguably the simplest method to set up a serial mouse.

  • Boot up normally and wait for Ubuntu to finish loading.
  • Press Ctrl+Alt+F1 to gain access to a text console (your screen will turn black with a prompt in white text, and if not running from the CD you may be asked to login).
  • Type the following exactly:
sudo nano -B /etc/X11/xorg.conf
  • If you have one, you will be asked for your user password.
  • The editor will open, displaying the xorg.conf file.
  • Navigate (using the arrow and/or Page Up/Down keys) to the following section:
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ExplorerPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection
  • Change the "Option Device" and "Option Protocol" lines as follows:
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/ttyS0"
Option "Protocol" "auto"
Option "ZAxisMapping" "4 5"
EndSection
change ttyS0 to ttyS1 if your mouse is connected to COM2 instead of COM1.
  • Type Ctrl+X then Y and Enter to save the changes to the file and exit.
  • Press Ctrl+Alt+F7 (to return to the graphical interface).
  • Press Ctrl+Alt+Backspace (NOT Delete!) to restart the graphical interface.
  • Hopefully your mouse now works. If not, type the following to undo your changes, just to be safe, before trying again using ttyS1 instead of ttyS0.
cd /etc/X11
sudo cp xorg.conf~ xorg.conf

(Note the symbol immediately after the first "xorg.conf" is a tilde. The error message cp: cannot stat... indicates a typing error here.)

If trying the other port also fails try another method below.


Manual editing of the xorg.conf file (without leaving graphical mode)

How to set up a serial mouse using only the keyboard and without working in a text-only console.

It is highly recommended that you make a backup copy of the "xorg.conf" file before making edits.

  • Login normally and wait for Ubuntu to finish loading.
  • Press "Alt+F1", to open the "Applications" menu.
  • Press down arrow to move to the "Accessories" item.
  • Press right arrow to get into the next "menu".
  • Press down arrow to move to the "Terminal" item.
  • Press Enter/Return to start a small terminal window.
  • Type in "gksudo gedit /etc/X11/xorg.conf" and press Enter/Return.
  • When asked, enter your password and press Enter/Return (gedit will open, displaying the xorg.conf file).
      • Using the keyboard, navigate to "Configured Mouse".
      • Change "/dev/input/mice" to "/dev/ttyS0" (or "/dev/ttyS1" if using COM2 instead of COM1)
      • Change "ExplorerPS/2" to "Auto"
  • Press "Ctrl+s" to save the changes.
  • Press "Ctrl+q" to close the editor.
  • Press "Ctrl+Alt+Backspace" to restart the X server.

Your mouse should work at this point, if it doesn't, restart the system.


Using Inputattach

  • Press Control-Alt-F1 to get to Virtual Terminal 1 (your screen will turn black and you'll see a login prompt in white text).
  • Login using your username and password.


  • Run 'inputattach --help' and find the appropriate protocol option to match your mouse
  • Add 'inputattach <protocol option> /dev/ttyS0' (or whatever device your serial mouse is attached to) to /etc/rc.local
  • Restart
  • Hopefully your mouse is now working, if not, remove the line you added to rc.local and try another method.

Configure Xserver (alternate method)

The installation will complete, and you will be able to log in but your mouse will not move or respond to button clicks. You need to reconfigure your xserver to see the mouse.

  • Press Control-Alt-F1 to get to Virtual Terminal 1 (your screen will turn black and you'll see a login prompt in white text).
  • Login using your username and password.
  • Enter the following command at the prompt
sudo dpkg-reconfigure xserver-xorg
  • Press Return to accept the existing settings UNTIL you get to the selection for the mouse port.
  • Choose whichever port your mouse is connected to:
  • first serial port: /dev/ttyS0
  • second serial port: /dev/ttyS1
  • Press Return to accept each the rest of the settings pages.
  • After you finish configuring the xserver, you will get back to a prompt in white text on a black background.
  • Switch back to the xserver by pressing Control-Alt-F7 (virtual terminal 7).
  • Kill the xserver by pressing Control-Alt-Backspace (This is NOT Control-Alt-Delete, which will make the machine shutdown).
  • When the xserver restarts, your mouse should work normally. If not, you may have chosen the wrong port. If necessary, press Control-Alt-F1 to go back to the virtual terminal and reconfigure the xserver again (following the steps above). If the xserver gives up, you can make it try again by typing startx at a virtual terminal prompt.

Installing Without a Mouse At All.

This method will help you if you MUST install Ubuntu on a pc with a serial mouse. Clearly you cant modify xorg.conf when running from the CD, so you CAN'T have a mouse during the installation process.

  • Exit the xserver
  • Create an .xinitrc file in your home directory, with the following line.
xterm -geometry +300+300
  • Save the file and run startx
  • Now you will have an X session. with a focused XTERM in the middle of your screen. Just type:
sudo ubiquity
And follow the installation procedure using only your keyboard.