https://wiki.archlinux.org/api.php?action=feedcontributions&user=NobodySpecial&feedformat=atomArchWiki - User contributions [en]2024-03-29T13:44:50ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Logitech_MX_Revolution&diff=246365Logitech MX Revolution2013-02-05T01:15:08Z<p>NobodySpecial: </p>
<hr />
<div>[[ru:Logitech MX Revolution]]<br />
[[Category:Mice]]<br />
<br />
Xorg is able to auto-detect this mouse just fine. However, it has a 17 key mapping:<br />
<br />
$ nano /etc/X11/xorg.conf<br />
<br />
Edit your mouse section to say something like:<br />
<br />
Section "InputDevice"<br />
Identifier "Mouse0"<br />
Driver "mouse"<br />
Option "Protocol" "auto"<br />
Option "Device" "/dev/input/mice"<br />
Option "ZAxisMapping" "4 5"<br />
#Option "XAxisMapping" "6 7" #uncomment if you want horizontal scrolling with mouse wheel<br />
Option "Buttons" "17"<br />
EndSection<br />
<br />
Next install the following packages<br />
<br />
pacman -S xbindkeys xvkbd<br />
<br />
We'll put all of the settings into ~/.xbindkeysrc<br />
<br />
touch ~/.xbindkeysrc<br />
nano ~/.xbindkeysrc<br />
<br />
<br />
You'll want to put in ~/.xbindkeysrc events to send to xvkbd. Here is a sample:<br />
<br />
"/usr/bin/xvkbd -text "\[Alt_L]\[Left]""<br />
m:0x0 + b:8<br />
"/usr/bin/xvkbd -text "\[Alt_L]\[Right]""<br />
m:0x0 + b:9<br />
"/usr/bin/xvkbd -text "\[Control_L]\[Page_Up]""<br />
m:0x0 + b:6<br />
"/usr/bin/xvkbd -text "\[Control_L]\[Page_Down]""<br />
m:0x0 + b:7<br />
<br />
For some reason some combinations of keyboard events refuse to work with certain buttons for me.<br />
<br />
m:0x0 refers to your first mouse. The "+b:8" refers to the button you push. Here is a list of all the buttons:<br />
<br />
# Mappings for keys for MX Revo<br />
# b:1 - left mouse button<br />
# b:2 - left and right mouse button together<br />
# b:3 - right mouse button<br />
# b:4 - mouse wheel up<br />
# b:5 - mouse wheel down<br />
# b:6 - mouse wheel left<br />
# b:7 - mouse wheel right<br />
# b:8 - back button<br />
# b:9 - forward button<br />
# b:10 - -none-<br />
# b:11 - -none-<br />
# b:12 - -none-<br />
# b:13 - media wheel up<br />
# b:14 - -none-<br />
# b:15 - media wheel down<br />
# b:16 - -none-<br />
# b:17 - media wheel press<br />
<br />
To remap the seach button to something instead of search, put something along the lines of the following into ~/.xbindkeysrc<br />
Example here is to remap it to alt+f4 to close a window.<br />
<br />
"/usr/bin/xvkbd -text "\[Alt_L]\[F4]""<br />
c:0xE1<br />
<br />
Alternatively, Gnome will recognize the small middle search button as a keyboard event. Thus, you just have to go into keyboard shortcuts and remap that to something. This is probably the most reliable way to go about using this key.<br />
<br />
It is possible to use xmodmap to register the button press as a middle click. Begin by assigning the key event to Pointer_Button 2.<br />
<br />
echo "keycode 225 = Pointer_Button2" >> ~/.xmodmaprc<br />
<br />
Now, just create a startup script that feeds that input into xmodmap when your window manager starts. In KDE4 create ~/.kde4/Autostart/middleclick with the following contents.<br />
<br />
#!/bin/sh <br />
xmodmap ~/.xmodmaprc<br />
<br />
And do not forget to give it execute permissions.<br />
<br />
chmod +x ~/.kde4/Autostart/middleclick<br />
<br />
The trick only works when "mousekeys" are on. So either gnome-keyboard-properties -> Mousekeys -> Enable pointer OR toggle with SHIFT-ALT-NUMLOCK (you want to be able to toggle so you can use the numeric keypad at times). Or in KDE System Settings -> Keyboard & Mouse -> Mouse -> Mouse Navigation -> Check "Move pointer with keyboard (using the num pad)"<br />
<br />
Lastly, add xbindkeys to your startup and you should be good to go.<br />
<br />
<br />
The best way to map the search button to middle click is to add the following two lines to /etc/sysctl.conf:<br />
# Enable mouse button emulation<br />
dev.mac_hid.mouse_button_emulation = 1<br />
# Set 2nd button to 217 - the middle button of MX Revolution mouse.<br />
dev.mac_hid.mouse_button2_keycode = 217<br />
<br />
== Mouse Wheel Mode ==<br />
In order to enable or disable mouse wheel's free spinning, you can use [https://aur.archlinux.org/packages.php?ID=8436 revoco]. Giving the following command from shell, or, alternatively, putting it in a script executed at the startup should enable/disable free spinning.<br />
# revoco free # in order to enable free spinning<br />
# revoco click # in order to disable free spinning<br />
More Info can be found [http://www.toosweettobesour.com/2009/05/13/logitech-mx-revolution-revoco-in-ubuntu-904-jaunty-click-to-click-even-after-a-resumewakeup/ here]</div>NobodySpecialhttps://wiki.archlinux.org/index.php?title=Mouse_buttons&diff=31389Mouse buttons2007-10-28T02:50:51Z<p>NobodySpecial: btnx</p>
<hr />
<div>[[Category:X Server (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
=== About / Prerequisites ===<br />
<br />
This article is for users that have a mouse with more than 7 mouse buttons and want to be able to use all of them. Logitech makes several of these, and Microsoft makes a few as well. If you have one of these mice, read on!<br />
<br />
*NOTE: These are helper comments, and can be ignored if you are looking for nothing but raw information. Due to community feedback, I decided to add a bit more commenting that describes what's going on "behind the scenes" with this configuration.<br />
<br />
We will be using the <tt>evdev</tt> driver for Xorg. EVentDEVice is an advanced driver for USB input devices which offers much greater power over the standard Xorg <tt>mouse</tt> driver. It's also more "direct" than the <tt>mouse</tt> driver, allowing lower latency and less translation issues.<br />
<br />
*Note that <tt>evdev</tt> is both a kernel module and an Xorg input driver. All the Arch kernels come with the <tt>evdev</tt> module.<br />
<br />
With the newer xorg 11R7.0 it seems only the following changes to /etc/X11/xorg.conf need to be made with nothing else needing to be done.<br />
<br />
=== Installing the evdev Drivers ===<br />
<br />
The first thing you need to do is install Xorg evdev package. The package cab be found in Current and is<br />
named [http://www.archlinux.org/packages/10240 xf86-input-evdev]. <br />
<br />
pacman -S xf86-input-evdev<br />
<br />
After it has been installed, modprobe the evdev module. <br />
<br />
modprobe evdev<br />
<br />
Now check the output of <tt>dmesg</tt> and make sure that evdev didn't have any errors. If everything worked, move on to the next section.<br />
<br />
=== Finding the Mouse Name ===<br />
'''Note:''' To get accurate information it is sometimes required to execute this command from a boot where no Xorg or mouse drivers have been loaded.<br />
<br />
The first step is to find the name of the mouse. To do this, execute the following command:<br />
<br />
egrep "Name|Handlers" /proc/bus/input/devices<br />
<br />
This should output something like this:<br />
<br />
N: Name="Logitech USB Gaming Mouse"<br />
H: Handlers=mouse0 event0 ts0 <br />
N: Name="HID 0566:3002"<br />
H: Handlers=kbd event1 <br />
<br />
The mouse is the one that has the <tt>Handlers=mouse0</tt>, so the name of the device is <tt>Logitech USB Gaming Mouse</tt>.<br />
<br />
* My mouse is a Logitch G5, your mouse is probably different, and therefore the Name will be different.<br />
<br />
Copy the name of the device, and open up <tt>/etc/X11/xorg.conf</tt>.<br />
<br />
=== Configuring Xorg ===<br />
Now, we need an entry in xorg.conf that tells X how to use this mouse. It should look something like this:<br />
<br />
Section "InputDevice"<br />
Identifier "Evdev Mouse"<br />
Driver "evdev"<br />
Option "Name" "Logitech USB Gaming Mouse"<br />
Option "CorePointer"<br />
EndSection<br />
<br />
Replace the "Name" option with the name you copied from above. You may also omit the "CorePointer" option if you use multiple mice or experience errors when attempting to load Xorg.<br />
<br />
Next, we need to tell X to use the mouse, so look in xorg.conf for <tt>ServerLayout</tt>.<br />
<br />
Modify the <tt>InputDevice</tt> section to use "Evdev Mouse" as the device. When you are done, it should look something like this:<br />
<br />
Section "ServerLayout"<br />
Identifier "Default Layout"<br />
Screen 0 "Monitor0" 0 0<br />
InputDevice "Keyboard0" "CoreKeyboard"<br />
InputDevice "Evdev Mouse" "CorePointer"<br />
EndSection<br />
<br />
The only thing you should change in the layout is the InputDevice line that refers to your mouse.<br />
<br />
That should be all that's required.<br />
<br />
=== Post Configuration ===<br />
==== Opera ====<br />
It just works™.<br />
<br />
==== Firefox ====<br />
By default, left right scroll on Fx translate into back/forward, respectively. If you don't like this, open <tt>about:config</tt> and change a few values:<br />
<br />
mousewheel.horizscroll.withnokey.action 0<br />
mousewheel.horizscroll.withnokey.numlines -3<br />
<br />
If you use a positive value for numlines, your left/right will switch, ie: pressing left scrolls the window to the right.<br />
<br />
==== Epiphany ====<br />
To get the back and forwards buttons working in this browser open <tt>about:config</tt> and change these values:<br />
<br />
mousewheel.horizscrool.withnokey.action 2<br />
mousewheel.horizscrool.withnokey.sysnumlines false<br />
<br />
==== Konqueror ====<br />
For the back and forward button to work, imwheel is needed.<br />
<br />
pacman -Sy imwheel<br />
<br />
<br />
Create the file .imwheelrc in your home dir:<br />
<br />
".*"<br />
None, Up, Alt_L|Left<br />
None, Down, Alt_L|Right<br />
<br />
Make sure imwheel is started during kde start.<br />
Create a file ~/.kde/Autostart/imwheel<br />
With the following contents:<br />
<br />
#!/bin/sh<br />
xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7 10 11"<br />
killall /usr/bin/imwheel<br />
imwheel -k -b "67"<br />
<br />
You can find you buttons by execute <tt>imwheel -D</tt> in a console and see which buttons belong to the back and forward button.<br />
<br />
==== xmodmap tweaking ====<br />
'''NOTE: None of the below is necessary with evdev, but it's here for non-evdev users. Unless something doesn't work on your mouse, ignore this whole section!'''<br />
<br />
If you use .xinitrc to load X, then add this to .xinitrc (change for the number of buttons you have):<br />
<br />
xmodmap -e "pointer = 1 2 3 6 7 8 9 10 11 12 4 5" &<br />
<br />
Note that buttons 4 and 5 <strong>must go on the end</strong> or else your scroll wheel won't work.<br />
<br />
If you use GDM/XDM/KDM instead of .xinitrc, then create the file ~/.Xmodmap and add this to it (change for the number of buttons you have):<br />
<br />
pointer = 1 2 3 6 7 8 9 10 11 12 4 5<br />
<br />
*GDM/XDM/KDM read the ~/.Xmodmap file if it's present, whereas <tt>startx</tt> does not. Another solution would be to add this to your ~/.xinitrc: <tt>xmodmap -e $(cat ~/.Xmodmap)</tt>. This would allow you to use *DM and <tt>startx</tt> while only having to edit ~/.Xmodmap when you need to make changes.<br />
<br />
You may have to play with these numbers a bit to get your desired behavior. Some mice use buttons 6 and 7 for the scroll wheel, in which case those buttons would have to be the last numbers. Keep playing with it until it works!<br />
<br />
You can also check to see which buttons are being read with a program called 'xev', which is part of XOrg. When xev is run, it will show a box on your desktop that you can put the cursor into and click buttons to find out what buttons have been mapped.<br />
<br />
=== Alternate Methods ===<br />
The following methods use standard X.org mouse input driver (xf86-input-mouse) instead of using the evdev driver. It works on mice up to 7 buttons. Edit /etc/X11/xorg.conf InputDevice section for your mouse to reflect the changes shown below. Then restart X and you're done.<br />
<br />
==== Method 1 - IMPS/2 ====<br />
This has been tested on an IntelliMouse Explorer 3.0. Your mileage may vary, as this does not seem to work for all said mice.<br />
<br />
Driver "mouse"<br />
Option "Protocol" "IMPS/2"<br />
Option "Device" "/dev/input/mice"<br />
Option "ZAxisMapping" "4 5 6 7"<br />
<br />
==== Method 2 - ExplorerPS/2 ====<br />
This has been tested on a Logitech MX400 and should work on any mx series mouse with up to 7 buttons. <br />
<br />
Driver "mouse"<br />
Option "Protocol" "ExplorerPS/2"<br />
Option "Device" "/dev/input/mice"<br />
Option "Buttons" "7"<br />
Option "ZAxisMapping" "4 5"<br />
Option "ButtonMapping" "1 2 3 6 7"<br />
<br />
==== Method 3 - Auto ====<br />
This has been tested on a Logitech MX400 and should work on most mice with up to 7 buttons.<br />
<br />
Driver "mouse"<br />
Option "Protocol" "auto"<br />
Option "Device" "/dev/input/mice"<br />
Option "Buttons" "7"<br />
Option "ZAxisMapping" "4 5"<br />
Option "ButtonMapping" "1 2 3 6 7"<br />
<br />
==== Method 4 - btnx ====<br />
[http://www.ollisalonen.com/btnx/ btnx: Button Extension- a GNU/GPL mouse tool for GNU/Linux]<br />
<br />
This allows the use of all buttons on the Logitech MX Revolution and reportedly other multi-button mice as well. Provides greater control & configuration than the evdev driver.<br />
<br />
Install via AUR:<br />
[http://aur.archlinux.org/packages.php?do_Details=1&ID=13476&O=0&L=0&C=0&K=btnx&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd btnx-config] then [http://aur.archlinux.org/packages.php?do_Details=1&ID=13477&O=0&L=0&C=0&K=btnx&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd btnx]<br />
Be sure the xorg.conf "Device" is at the default "/dev/input/mice" rather than "evdev".<br />
<br />
=== Binding keyboard to mouse buttons ===<br />
<br />
==== xvkbd and xbindkeys ====<br />
Let's say we want to bind some mouse buttons to keyboard ones. The problem we will encounter is that we don't know how to emulate a key press. Here comes in handy xvkbd. It isn't avaible via pacman, but we can find it on AUR [http://aur.archlinux.org/packages.php?do_Details=1&ID=616&K=xvkbd]. We can use it along with xvbindkeys. <br />
<br />
pacman -S xbindkeys<br />
xbindkeys --defaults >> ~/.xbindkeysrc<br />
xbindkeys<br />
<br />
to restart xbindkeys type:<br />
<br />
pkill -f xbindkeys<br />
xbindkeys <br />
<br />
Here's example ~/.xbindkeysrc config:<br />
<br />
"xvkbd -text "\[F8]""<br />
m:0x0 + b:8<br />
"xvkbd -text "\[Shift]\[Left]""<br />
m:0x0 + b:9<br />
"xvkbd -text "\[Shift]\[Right]""<br />
m:0x0 + b:10<br />
"xvkbd -text 2"<br />
m:0x0 + b:11<br />
"xvkbd -text 3"<br />
m:0x0 + b:12<br />
<br />
if you want to check your mouse buttons number use xev. Don't forget to type capital letters in xvkbd -text usage and to escape opening bracket with \, or you get simply [Shift] written.<br />
<br />
==== Why standard methods are not enough? ====<br />
This will work great for X servers, but it seems not to work in some specific situations, like in Enemy Territory game. So I will describe a bit more advanced configuration, which work with my logitech G5 buttons - I can use all my 5 additional buttons along with 3 standard and a scroll, which gives overall 10 events to use in Enemy Territory. So here we go:<br />
<br />
<br />
<br />
==== kbde ====<br />
To emulate keystroke which will be later detected in Enemy Territory we need something more advanced than xvkbd. Here comes in handy kbde, but it doesn't exist in AUR yet - we've got to compile it by ourselves. We need two programs: kbde and kbde-driver. Kbde website is located on sourceforge [http://kbde.sourceforge.net/], check it for download, you need only kbde-driver. Apparently, it doesn't work for me without some hacking. Use your editor and add <br />
<br />
#include <linux/version.h><br />
<br />
somewhere near other includes in the driver/kbde.c file. (OK, I'm not sure whether it is a proper way to compile it, but it works).<br />
Assuming that you've already done that try:<br />
<br />
tar -zxvf kbde-driver-1*<br />
cd kbde-driver-1*<br />
make<br />
# if you don't have sudo just use su and type this as root<br />
sudo make install mknod<br />
modprobe kbde<br />
<br />
and now you should have kbde working. If you want to use it as a non-root (yes, you want) change permissions, the quickest and dirtiest way is (note that I added my startup scripts at the end of this text):<br />
<br />
chgrp users /dev/kbde<br />
chmod 220 /dev/kbde<br />
<br />
If not try reading installation instructions on the site. Now we can use it to emulate keystrokes visible even in login shells:<br />
<br />
kbde --press 5 --release 5 -b<br />
<br />
this will press 5 for about three times. If you want to type a string using this, rather than this use --asci=STRING, as press sometimes generates 3 strokes before it is released.<br />
<br />
==== evrouter ====<br />
Now we need something which will work when Enemy Territory is loaded. Apparently, xbindkeys doesn't work here, so we need another program, which isn't added to AUR: evrouter [http://www.bedroomlan.org/~alexios/coding_evrouter.html]<br />
<br />
wget http://freshmeat.net/redir/evrouter/47427/url_tgz/evrouter_0.3.2.tar.gz<br />
tar -zxvf evrouter_0.3.2.tar.gz<br />
cd evrouter<br />
./configure --prefix=/usr/<br />
make<br />
make install<br />
# if you want to know more at this point use:<br />
man evrouter<br />
<br />
OK, so now we must have evdev and we canNOT use it in X, so here's how my example /etc/X11/xorg.conf mouse section looks like:<br />
<br />
Section "InputDevice"<br />
<br />
Identifier "Logitech G5"<br />
<br />
Driver "mouse"<br />
Option "Protocol" "Auto"<br />
Option "Device" "/dev/input/mouse1" # probably you'll need here mouse0<br />
Option "Name" "Logitech USB Gaming Mouse"<br />
Option "Buttons" "8" # set this to your number of buttons<br />
Option "ZAxisMapping" "4 5"<br />
<br />
EndSection<br />
<br />
and now we've got to restart X server. <br />
You will run this as user, and event devices are owned by root, so you got to change the permissions at this point. Let's say we do it just like that, but I advice you to do this more carefully (note that I added my startup scripts at the end of this text):<br />
<br />
chgrp users /dev/input/event*<br />
chmod 660 /dev/input/event*<br />
<br />
Now we can use --dump option to check what we will have to bind and to which device:<br />
<br />
evrouter --dump /dev/input/event*<br />
# here click buttons you would like to bind<br />
<br />
It will give you output similar to config. Here's my example config ~/.evrouterrc with kbde usage:<br />
<br />
"Logitech USB Gaming Mouse" "/dev/input/event.*" any key/278 "SHELL/kbde --press 2 --release 2 -b"<br />
"Logitech USB Gaming Mouse" "/dev/input/event.*" any key/279 "SHELL/kbde --press 3 --release 3 -b"<br />
"Logitech USB Gaming Mouse" "/dev/input/event.*" any key/274 "SHELL/kbde --press 4 --release 4 -b"<br />
"Logitech USB Gaming Mouse" "/dev/input/event.*" any key/277 "SHELL/kbde --press 5 --release 5 -b"<br />
"Logitech USB Gaming Mouse" "/dev/input/event.*" any key/276 "SHELL/kbde --press 6 --release 6 -b"<br />
<br />
this works great, even in enemy territory. "none" modifier means that I have to only press the button, other options are ctrl+alt and so on. Here I use "any" because "none" means that after pressing shift, ctrl or alt our buttons would not work. Also note that it accepts regex for mouse name and event path. Then, after setting up a config, run service with:<br />
<br />
evrouter /dev/input/event* >> /dev/null<br />
<br />
or change the event* to a device corresponding to your mouse - but be aware that the numbers are changing sometimes. It will work in background, while outputting some annoying messages, so we stream it to devnull. If something went wrong, run it without streaming and check what it outputs. If you want to end it, you have to delete /tmp/evrouter.* manually, here's a script to kill evrouter:<br />
<br />
#!/bin/bash<br />
evrouter -q<br />
rm -f /tmp/.evrouter*<br />
<br />
and here's one to start it:<br />
<br />
#!/bin/bash<br />
mydevicename="Logitech USB Gaming Mouse"<br />
<br />
device=`evrouter -D /dev/input/event* | grep "$mydevicename"` | cut -d ":" -f 2<br />
evrouter $device > /dev/null<br />
<br />
You have to edit the mydevicename var to proper value (the one which is shown by evrouter -D), or just change it to listen on all events by changing device var to /dev/input/event*. OK, I've saved them in /usr/bin/ . Now, everything should be ready for use!<br />
<br />
==== binding + and - in logitech G5 mouse ====<br />
If you want to bind buttons + and - in G5/7 mouse, which normally changes dpi, you have to use g5hack [http://piie.net/temp/g5_hiddev.c] released by a lomoco author.<br />
<br />
wget http://piie.net/temp/g5_hiddev.c<br />
gcc -o g5hack g5_hiddev<br />
./g5hack /dev/usb/hiddev0 3<br />
<br />
This will change your dpi to 2000, light the 1st led and disables dpi on-the-fly changing, so you can use it with evrouter. If you would use it frequently I suggest you to copy it to the /usr/bin dir:<br />
<br />
sudo cp g5hack /usr/bin/<br />
<br />
==== startup scripts ====<br />
Currently, I am using startup script with a bit dirty methods, so if somebody can propose better, please edit. I have created input group and make my user a member of it.<br />
/etc/rc.local:<br />
<br />
#!/bin/bash<br />
# creating /dev/kbde nod and changing permissions<br />
# also don't forget to add kbde in modules line in /etc/rc.conf<br />
# to be honest, I'm not sure why we have to create /dev/kbde after each startup, but it seems that only this way it works<br />
# maybe first check if it's needed for you, too<br />
mknod --mode=220 /dev/kbde c 11 0 <br />
chgrp input /dev/kbde<br />
# changing permissions for event* -- evrouter needs that<br />
chmod 660 /dev/input/event*<br />
chgrp input /dev/input/event*<br />
# g5hack ran for a few times to make sure that it'll work...<br />
# note that I've add it to /usr/bin, you should probably put your full path here<br />
# you probably should skip this lines, especially if you don't have logitech g5/g3/g7<br />
g5hack /dev/usb/hiddev0 3<br />
g5hack /dev/usb/hiddev0 3<br />
g5hack /dev/usb/hiddev0 3<br />
<br />
~/.kde/Autostart/init:<br />
<br />
#!/bin/bash<br />
# there I use my script to start evrouter, which I have presented above<br />
evrouter-start<br />
# here I map my buttons so I can use G5 thumb button as push to talk in TS<br />
# note that I have to use it as middle button also on kde <br />
# you probably don't need it<br />
xmodmap -e "pointer = 1 9 3 4 5 6 7 2 8 10 11 12"<br />
<br />
And voila, we've got it working immediately after kde login.<br />
<br />
=== User Tools ===<br />
'''NOTE: This section is out of date, and the lomoco package may also be out of date. There is a hack for a newer logitech mice: [http://piie.net/temp/g5_hiddev.c]'''<br />
<br />
If you use a MX* Logitech mouse, there is a tool called <tt>lomoco</tt> which will help you set the proper resolution, enable or disable smart scroll (with boot time support too!), etc. lomoco is available from the Community repository and can be installed with the following command:<br />
<br />
pacman -S lomoco<br />
<br />
*Be sure to look at <tt>/etc/udev/lomoco_mouse.conf</tt> and set up the the options you want to be automatically applied when the mouse gets loaded by udev. <br />
<br />
=== Credits ===<br />
linuX-gamers.net How-Tos: Getting all mouse buttons working in X</div>NobodySpecialhttps://wiki.archlinux.org/index.php?title=VMware&diff=29315VMware2007-09-17T00:44:30Z<p>NobodySpecial: </p>
<hr />
<div>[[Category:Emulators (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[http://www.vmware.com/ VMware] installs on [[ArchLinux]] pretty well, but its not totally straight forward.<br />
<br />
== Installation ==<br />
<br />
You can use the [http://aur.archlinux.org/packages.php?do_Details=1&ID=6182&O=0&L=0&C=0&K=vmware&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd AUR] or manually install [http://www.vmware.com/download/server/ VMware Server] downloaded from [http://www.vmware.com/ VMware.com]. This guide shows you how to install the manually downloaded VMware server tarball, assuming you are running Voodoo or newer (Duke) with kernel version 2.6.20+ '''32-bit'''.<br />
<br />
===Requirements:===<br />
* Root access. Either 'sudo' or 'su'. For this guide, I will be using 'sudo'.<br />
* [http://archlinux.org/packages/search/?repo=all&category=all&q=xinetd&lastupdate=&limit=50 Xinetd] is installed, up and running.<br />
* [http://www.vmware.com/download/server/ VMware server tarball]; latest is 1.0.3 build 44356 (26APR2007) as of this writing.<br />
* VMware server [http://www.vmware.com/community/thread.jspa?messageID=76957&tstart=0 any-to-any]" patch: [http://platan.vc.cvut.cz/ftp/pub/vmware mirror 1] and [ftp://ftp.cvut.cz/vmware mirror 2]. Note: For server 1.0.3 build 44356 you need patch 110, which is on mirror 1 only (26MAY2007).<br />
<br />
===Instructions:===<br />
* Run '''''sudo mkdir -p /etc/rc.d/vmware.d/rc{0,1,2,3,4,5,6}.d''''' to create VMware runlevel directories.<br />
* Run '''''sudo ln -s /bin/lsmod /sbin/''''' to create symlink for lsmod.<br />
* Extract VMware server tarball somewhere... i.e. /tmp/.<br />
* Run '''''cd /tmp/vmware-server-distrib;sudo ./vmware-install.pl'''''. I used '''''/home/vmware/bin''''' for installation.<br />
* When it asks where the directories for ''rc0.d'' thru ''rc6.d'' are, use '''''/etc/rc.d/vmware.d'''''.<br />
* When it asks where the init directory is, use '''''/etc/rc.d'''''.<br />
* '''*QUIT*''' when it asks you if you want to run VMware configuration for the first time.<br />
* Extract VMware server any-to-any patch somewhere... i.e. /tmp/.<br />
* Run '''''cd /tmp/vmware-any-any-update*REV*;sudo ./runme.pl'''''. This will patch VMware server modules to allow Linux kernel 2.6.20 compilation.<br />
* Run '''''cd /home/vmware/bin;sudo ./vmware-config.pl''''' to compile VMware modules.<br />
<br />
== Running ==<br />
<br />
It's a possibility the first time you try to run Vmware server it'll throw an error stating something about "Unable to power virtual machine". Stop the VMware server and restart xinetd wtih '''''/etc/rc.d/vmware stop;wait;/etc/rc.d/xinetd restart'''''.<br />
<br />
Rerun '''''sudo /home/vmware/bin/vmware-config.pl''''' again. If this still fails, restart your computer and do the above again. It should be fixed.<br />
<br />
There is now a <code>vmware</code> init script in <code>/etc/rc.d</code>. You can add this to your daemons list if you want. I personally dont do this, but if you intend to use the vmware's network when not actually using vmware, then you will need to do this. You will need to start it before you can run vmware though.<br />
<br />
There is a problem with vmware unable to run correctly after a reboot. To fix this edit <code>/etc/rc.d/vmware</code>, find the text below<br />
case "$1" in<br />
start)<br />
and put<br />
rm /etc/vmware/not_configured<br />
immediately after that line.<br />
<br />
To start vmware, you just do <code>vmware</code> from a console window, or create a shortcut or menu item however you like.<br />
<br />
'''Some notes:'''<br />
<br />
Leave the <code>/etc/rc.d/vmware.d</code> directory there, because it is needed whenever you perform <code>vmware-config.pl</code>.<br />
<br />
Remember, if the kernel is changed or updated, you will need to run <code>vmware-config.pl</code> again.<br />
<br />
== Kernel 2.6 and udev ==<br />
<br />
Follow the steps above and then:<br />
<br />
'''1. Modify udev config'''<br />
<br />
Edit <code>/etc/udev/rules.d/00-myrules.rules</code> and add 2 lines:<br />
# tty devices<br />
KERNEL="tty<nowiki>[[0-9]]</nowiki>*", NAME="vc/%n", SYMLINK="%k"<br />
<br />
# floppy devices<br />
KERNEL="fd<nowiki>[[0-9]]</nowiki>*", NAME="floppy/%n" , SYMLINK="fd%n"<br />
<br />
'''2. Start/stop script'''<br />
<br />
It takes care of devices and starts vmware, also stops vmware and removes dev entries. Call it, for example, <code>mkvmdev</code>, chmod it <code>755</code> and put in <code>/etc/rc.d</code>:<br />
<br />
<pre><br />
#!/bin/sh<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
case "$1" in<br />
start)<br />
stat_busy "Creating /dev entries and starting VMware"<br />
for i in `seq 0 9`; do<br />
mknod /dev/vmnet$i c 119 $i<br />
chmod 0600 /dev/vmnet$i<br />
done<br />
for i in `seq 0 3`; do<br />
mknod /dev/parport$i c 99 $i<br />
chmod 0600 /dev/parport$i<br />
done<br />
mknod /dev/vmmon c 10 165<br />
chmod 0660 /dev/vmmon<br />
/etc/rc.d/vmware start<br />
;;<br />
<br />
stop)<br />
stat_busy "Stopping VMware and removing /dev entries"<br />
/etc/rc.d/vmware stop<br />
rm /dev/vmmon<br />
for i in `seq 0 3`; do<br />
rm /dev/parport$i<br />
done<br />
for i in `seq 0 9`; do<br />
rm /dev/vmnet$i<br />
done<br />
;;<br />
<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
<br />
*)<br />
echo "usage: $0 {start|stop|restart}"<br />
esac<br />
exit 0<br />
</pre><br />
<br />
'''3. Modify <code>/etc/rc.conf</code>.''' (*Note - this step is optional! See also the notes under the "Running" section above)<br />
<br />
Add <code>mkvmdev</code> to daemons in your <code>rc.conf</code>, and remember to remove <code>vmware</code> from <code>rc.conf</code>. Or if you prefer, you can delete the lines that launch vmware from <code>mkvmdev</code> and leave your original <code>vmware</code> in <code>rc.conf</code> - your choice.<br />
<br />
-----<br />
<br />
'''Comments:'''<br />
<br />
hi guys, a couple of quick questions:<br><br />
- why is /dev/vmmon chmod 0660, as opposed to the rest (0600)?<br><br />
- i suppose /dev/vmmon should be "rm"-ed as well in the "stop" section for the script above? (that line is missing) - FIXED<br />
<br />
== vmware and kernel 2.6.20 compile modules problem ==<br />
<br />
Below is a solution for compiling the vmware modules on kernel 2.6.20.<br />
<br />
<pre><br />
cd /usr/lib/vmware/modules/source/<br />
sudo tar -xvf vmmon.tar<br />
cd vmmon-only<br />
sudo vi include/compat_kernel.h<br />
<br />
Find this:<br />
<br />
#define __NR_compat_exit __NR_exit<br />
static inline _syscall1(int, compat_exit, int, exit_code);<br />
<br />
and change the static inline ..... line to:<br />
<br />
int compat_exit(int exit_code);<br />
<br />
Then tar up the vmmon-only directory again.<br />
<br />
cd .. #go back to the source directory<br />
tar -cf vmmon.tar vmmon-only<br />
<br />
Finally, run vmware-config.pl<br />
</pre><br />
<br />
== vmware and kernel 2.6.16 compile modules problem ==<br />
'''PROBLEM''': kernel 2.6.16-x - vmware or vmwareplayer complains that headers are incorect.<br><br />
'''FIX''': You need [http://knihovny.cvut.cz/ftp/pub/vmware/vmware-any-any-update101.tar.gz vmware-any-any-update] patch [ftp://ftp.cvut.cz/vmware/vmware-any-any-update101.tar.gz mirror here] [http://www.inarad.ro/soft/vmware/vmware-any-any-update101.tar.gz or here].<br> Just untar the archive and run ./runme.pl as root - and you-re happy again!<br />
<br />
== vmware on kernel 2.6.22 ==<br />
May not work properly yet. Apply the patch from http://knihovny.cvut.cz/ftp/pub/vmware/vmware-any-any-update112.tar.gz , replace vmnet.tar with http://npw.net/~phbaer/vmnet.tar and reinstall. Note: this is an '''ugly hack''', please dont put it into production systems. Some guest OS'es may have crashes and networking problems with this. '''Dont tell us that you havent been warned'''<br />
<br />
== slow networking between host and guest ==<br />
"Those oversized improperly checksummed packets are TCP Segmentation Offload packets. Use ''''ethtool -k eth0 tso off'''' to disable TSO on eth0 (or any other interface which you want to get bridged). At this moment vmnet does not understand TSO, and in addition to that it is silly to use TSO together with bridged networking as vmnet will have to split such packet anyway to pass it to the guest, so splitting will be done anyway, and in addition to it kernel will have to prepare metadata about TCP stream for hardware, so you'll probably get worse performance with TSO enabled than with disabled when you'll have some guest running."<br />
<br />
'''NOTE:''' ''ethtool is on extra packages''<br />
<br />
== Samba issues ==<br />
The guest os under vmware cannot see a samba share running on the linux host. To fix this problem, edit /etc/samba/smb.conf and make some changes under [global]. The following are suggested:<br><br />
workgroup = YOUR_WORKGROUP<br><br />
netbios name = YOUR_SERVER_NAME<br><br />
encrypt passwords = yes<br><br />
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192<br><br />
interfaces = eth0 vmnet1 vmnet8<br><br />
sysv shm key=/dev/vmnet1<br><br />
bind interfaces only = true<br></div>NobodySpecial