# invert Z axis using moused(8)



## blah (Feb 20, 2009)

For *X* and *Y* it's

`# moused -a -1,-1`

which is analougous to[font=monospace]Option "InvX" "on"
Option "InvY" "on"​[/font]in xorg.conf. But what is analogous to...?[font=monospace]Option "ZAxisMapping" "5 4"​[/font]I see moused(8)() mentions *-z* option. But there are no examples. How I'm supposed to use it?
	
	



```
> dmesg | fgrep ums
ums0: <Logitech USB-PS/2 Optical Mouse, class 0/0, rev 2.00/22.00, addr 2> on usbus0
ums0: 8 buttons and [XYZ] coordinates
Symlink: ums0 -> usb0.2.0.16
> moused -fd -a -1,-1 -p /dev/ums0 -t auto -I /var/run/moused.ums0.pid
moused: proto params: f8 80 00 00 8 00 ff
moused: port: /dev/ums0  interface: usb  type: sysmouse  model: generic
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x1
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,0,1,7f
moused: ts:  147273 458992495
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 1
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0xff
moused: received char 0x0
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,ff,0,7f
moused: ts:  147274 394700924
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000000  dx 0  dy 0  dz -1
```


----------



## trev (Feb 20, 2009)

You seem a little confused or you've confused me 

-a X[,Y] deals with acceleration and has nothing to do with inverting the X and Y axis as documented in moused(4) thus:


```
-a X[,Y]
             Accelerate or decelerate the mouse input.  This is a linear
             acceleration only.  Values less than 1.0 slow down movement, val-
             ues greater than 1.0 speed it up.  Specifying only one value sets
             the acceleration for both axes.
```

As for the -z flag, it is well documented in moused(4) thus:


```
-z target
             Map Z axis (roller/wheel) movement to another axis or to virtual
             buttons.  Valid target maybe: [...]
```

In xorg.conf, ZAxisMapping defines the layout for the mouse buttons. Depending on what order you choose, the behaviour of your mouse will change. Similarly, you can use the -z flag to moused to do the same thing as explained in the man page.,


----------



## blah (Feb 21, 2009)

trev said:
			
		

> -a X[,Y] deals with acceleration and has nothing to do with inverting the X and Y axis as documented in moused(4) thus:


So why acceleration cannot happen in opposite direction? Depending on sign it will be forward/backward acceleration/deceleration. If I want to swap forward and backward directions I use *-1* as a coefficient. What's wrong with my assumption?



			
				trev said:
			
		

> In xorg.conf, ZAxisMapping defines the layout for the mouse buttons. Depending on what order you choose, the behaviour of your mouse will change. Similarly, you can use the -z flag to moused to do the same thing as explained in the man page.


Can you *verify* that it has similar effect? In my case specifying `*-z "5 4"*' on the command line makes scrolling no longer functional.
	
	



```
> moused -fd -z "5 4" -p /dev/ums0
moused: optind: 4, optarg: '5 4'
moused: proto params: f8 80 00 00 8 00 ff
moused: port: /dev/ums0  interface: usb  type: sysmouse  model: generic
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0xff
moused: received char 0x0
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,ff,0,7f
moused: ts:  159077 918534375
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000010  dx 0  dy 0  dz 0
moused: mstate[4]->count:1
moused: button 5  count 1
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[4]->count:1
moused: button 5  count 0
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x1
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,0,1,7f
moused: ts:  159078 855017224
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000020  dx 0  dy 0  dz 0
moused: mstate[5]->count:1
moused: button 6  count 1
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[5]->count:1
moused: button 6  count 0
```
but Xorg detects buttons as usual, ie. "4 5"
	
	



```
# Xorg.0.log with pointer related configuration removed
(WW) <default pointer>: No Device specified, looking for one...
(II) <default pointer>: Setting Device option to "/dev/sysmouse"
(--) <default pointer>: Device: "/dev/sysmouse"
(==) <default pointer>: Protocol: "Auto"
(**) Option "CorePointer"
(**) <default pointer>: always reports core events
(==) <default pointer>: Emulate3Buttons, Emulate3Timeout: 50
(**) <default pointer>: ZAxisMapping: buttons 4 and 5
(**) <default pointer>: Buttons: 9
(**) <default pointer>: Sensitivity: 1
(II) XINPUT: Adding extended input device "<default pointer>" (type: MOUSE)
(**) <default pointer>: (accel) keeping acceleration scheme 1
(**) <default pointer>: (accel) acceleration profile 0
(**) <default pointer>: (accel) filter chain progression: 2.00
(**) <default pointer>: (accel) filter stage 0: 20.00 ms
(**) <default pointer>: (accel) set acceleration profile 0
(II) <default pointer>: SetupAuto: hw.iftype is 4, hw.model is 0
(II) <default pointer>: SetupAuto: protocol is SysMouse
```
though using mouse wheel doesn't have any effect on scrollbar.

In what way non-functional scrolling is similar to inverted scrolling produced by ZAxisMapping?


----------



## trev (Feb 21, 2009)

blah said:
			
		

> So why acceleration cannot happen in opposite direction? Depending on sign it will be forward/backward acceleration/deceleration. If I want to swap forward and backward directions I use *-1* as a coefficient. What's wrong with my assumption?



The negative of acceleration is *de-celeration* and not a change of direction! Speed increases by +n and decreases by -n.



> In my case specifying `-z "5 4"' on the command line makes scrolling no longer functional.



Have you verified these are the correct button numbers? From your debug output, events appear to be registering buttons 4 and 6, not 4 and 5.


----------



## blah (Feb 21, 2009)

trev said:
			
		

> Have you verified these are the correct button numbers? From your debug output, events appear to be registering buttons 4 and 6, not 4 and 5.


Thanks for hint. I've spotted smth
	
	



```
> moused -fd -z "4 8" -p /dev/ums0
moused: optind: 4, optarg: '4 8'
moused: proto params: f8 80 00 00 8 00 ff
moused: port: /dev/ums0  interface: usb  type: sysmouse  model: generic


# mouse wheel down event
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x1
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,0,1,7f
moused: ts:  189854 639876968
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000010  dx 0  dy 0  dz 0
moused: mstate[4]->count:1
moused: button 5  count 1
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[4]->count:1
moused: button 5  count 0


# mouse wheel up event
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0xff
moused: received char 0x0
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,ff,0,7f
moused: ts:  189855 936007202
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000008  dx 0  dy 0  dz 0
moused: mstate[3]->count:1
moused: button 4  count 1
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[3]->count:1
moused: button 4  count 0
```


```
> moused -fd -z 4 -z 8 -p /dev/ums0
moused: optind: 4, optarg: '4'
moused: optind: 6, optarg: '8'
moused: proto params: f8 80 00 00 8 00 ff
moused: port: /dev/ums0  interface: usb  type: sysmouse  model: generic


# mouse wheel down event
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x1
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,0,1,7f
moused: ts:  189733 696501972
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000100  dx 0  dy 0  dz 0
moused: mstate[8]->count:1
moused: button 9  count 1
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[8]->count:1
moused: button 9  count 0


# mouse wheel up event
moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0xff
moused: received char 0x0
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,ff,0,7f
moused: ts:  189735 879936808
moused: flags:80000000 buttons:00000000 obuttons:00000000
moused: activity : buttons 0x00000080  dx 0  dy 0  dz 0
moused: mstate[7]->count:1
moused: button 8  count 1
moused: activity : buttons 0x00000000  dx 0  dy 0  dz 0
moused: mstate[7]->count:1
moused: button 8  count 0
```
Looks like I'm unable to specify what button controls negative Z axis movement. How do I specify these N1 N2 then? But aside from this playing with `-z' option doesn't affect scrolling at all. Though I can use mouseWheel instead of left/right button.

BTW, my mouse is Logitech MX518.


----------



## trev (Feb 22, 2009)

The correct syntax from the man page is -z N1 N2 where N1 and N2 are the relevant buttons.

As I don't have your exotic mouse, you'll have to experiment yourself with the different possibilities.


----------

