Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, None of the resources I've found for xorg.conf and mouse support in x11 have solved my problem so far, hoping someone here can help me out. I'm faking a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    2

    x11 mouse scrolling


    Hi,

    None of the resources I've found for xorg.conf and mouse support in x11 have solved my problem so far, hoping someone here can help me out.

    I'm faking a mouse in Red Hat Linux, using infrared light and a small c++ program. I have mouse clicks working fine but every attempt to scroll just creates a "right click". The relevant section of my xorg.conf looks like this:
    Code:
    Section "InputDevice"
            Identifier  "LIRC-Mouse"
            Driver      "mouse"
            Option      "Device" "/tmp/tm"
            Option      "Protocol" "IMPS/2"
            Option      "Mode" "absolute"
            Option      "Buttons" "5"
    	Option	    "EmulateWheel" "True"
            Option      "YAxisMapping" "4 5"
            Option      "ZAxisMapping" "4 5"
    EndSection
    Originally, I had just the ZAxisMapping in there, I added YAxisMapping after reading another thread somewhere.

    The issue could also be in the c++ code, I'm just modifying existing code. Here's the relevant portions of it:

    Code:
    #define BUTTON1 0x04
    #define BUTTON2 0x02
    #define BUTTON3 0x01
    
    void msend(int dx,int dy,int dz,int rep,int buttp,int buttr)
    {
            static int buttons=0;
            int f=1;
            char buffer[5];
            buttons|=buttp;
            buttons&=~buttr;
    
            switch(ms.protocol)
            {
    case imps_2:
                    buffer[0] = ((buttons&BUTTON1) ? 0x01:0x00)
                               |((buttons&BUTTON3) ? 0x02:0x00)
                               |((buttons&BUTTON2) ? 0x04:0x00)
                               |                     0x08
                               |(dx<0 ? 0x10:0x00)
                               |(dy<0 ? 0x20:0x00);
                    buffer[1]=dx+(dx>=0 ? 0:256);
                    buffer[2]=dy+(dy>=0 ? 0:256);
                    buffer[3]=dz;
    
                    while(f>0)
                    {
                            f--;
                            write(tm,buffer,4);
                    }
                    break;
    My knowledge in this area is severly lacking. My goal is simply to make X11 create a scroll event when I call this msend function with the appropriate values. Right now, if I call it with buttp (pressed) or buttr (released) as 4 it creates the appropriate left mouse functionality. However, seemingly every other value just creates a right-click.

  2. #2
    Just Joined!
    Join Date
    Aug 2007
    Posts
    2
    I've made some progress but still haven't solved my problem. Now, instead of scrolling I just get that both key 4 and 5 are the same as clicking the scroll wheel as a button on my mouse.

    Anyone know what might be causing it to treat them as clicks instead of scrolls? Here is the new xorg.conf:

    Code:
    Section "InputDevice"
            Identifier  "LIRC-Mouse"
            Driver      "mouse"
            Option      "Device" "/tmp/tm"
            Option      "Protocol" "IMPS/2"
            Option      "Mode" "absolute"
            Option      "Buttons" "5"
            Option      "ZAxisMapping" "4 5"
    EndSection
    And the c++ code has been changed to do away with the buttons&BUTTON1 type garbage and now the application just directly sends the right code (instead of switching around 4's to 1's and so forth for the protocal switch).

    Thanks,
    PA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •