:: Re: [DNG] mouse driver question
Inizio della pagina
Delete this message
Reply to this message
Autore: Fred
Data:  
To: dng
Oggetto: Re: [DNG] mouse driver question
On 4/27/22 15:40, karl@??? wrote:
> Fred:
> ...
>> In spare time I am building a board to convert mouse output to RS232. I
>> did research on this in 2011. I found a program I wrote (for embedded
>> controller) to watch serial port and show mouse bytes on lcd. I don't
>> know yet if it was finished or works. Viewing the mouse output with an
>> oscilloscope shows it is definitely 1200 baud and appears to be 8 data
>> bits odd parity and one stop bit. The mouse is sending 5 bytes.
>
> I made a program that "spied" on a serial port, reporting all bytes
> coming in and out from a serial port. It worked by using pty's.
> It has seen some bitrot, but perhaps I can shape it up during the
> summer.
>
> In the meantime, you could watch the input bytes by doing
>
> # stty -F /dev/ttyS4 1200 cs8 raw
> # cat /dev/ttyS4 | od -t x1 # and then move the mouse
> 0000000 40 01 00 4c 3d 4c 05 3f 4c 04 3f 02 3f 40 00 01
> 0000020 40 01 01 40 02 03 40 02 40 03 40 00 04 43 3d 06
> 0000040 43 3c 06 43 3b 06 43 3b 04 43 3d 01 40 00 01 43
> 0000060 3f 00 4f 3f 3f 4f 3f 3f 4f 3e 3f 4f 3f 3c 3d 4f
> 0000100 3b 4f 3d 4f 3f 4c 00 3f 4c 00 3f 4c 01 3f 4c 01
> ^C
>
> # cat /dev/ttyS4 | od -t x1 # pressing the right button
> 0000000 40 00 50 00 00 40 00 00 50 00 40 00 50 00 40 00
> 0000020 50 00 00 40 00 00 50 00 40 00 00 50 00 40 00 50
> ^C
>
> # cat /dev/ttyS4 | od -t x1 # pressing the left button
> 0000000 60 00 40 00 00 60 00 40 00 00 60 00 00 40 00 60
> 0000020 00 40 00 00 60 00 40 00 00 60 00 40 00 60 00 40
> ^C
>
> od waits to fill one line before it writes out anything.
>
> Descriptions of mouse protocols are available here:
> https://courses.cs.washington.edu/courses/cse477/00sp/projectwebs/groupb/PS2-mouse/mouse.html
> https://www.kryslix.com/nsfaq/Q.12.html
> man mouse
>
>> I tried gpm again in a VT. The left button highlights a single
>> character or lines. The right button highlights lines from the last
>> left button click. The middle button prints the character that was
>> under the cursor at last left button click.
>
> $ man gpm
>   ...
> OPERATION
>     To select text press the left mouse button and drag the mouse.
>     To paste text in the same or another console, press the middle button.
>     The right button is used to extend the selection, like in `xterm'.

>
> Soo, it works as adverticed above ?
> Then the problem is that the input subsystem is doing the wrong things
> (i.e. in the kernel git repo, drivers/input/mouse/sermouse.c needs some
> fix) or it is been set up wrongly.
>
>> I think inputattach is actually doing what it is supposed to do but is
>> telling the application something different from what the standard
>> scroll wheel pc mouse does.
>
> inputattach is just setting up the kernel to read and translate the
> mouse packets. The packets then appear somewhere at /dev/input/
> which X11 reads.
>
> Regards,
> /Karl Hammar
>
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Hi,
The Sun Compact 1 three button mouse is 1200 baud, 8 data bits, no
parity and sends 5 bytes in Mouse Systems protocol. Byte 0 is button
info. exactly the same as msc. Byte 1 is 8 bit signed X movement. Byte
2 is 8 bit signed Y movement. Bytes 3, 4 are zero.

In the application I need to use the Sun mouse, the PC mouse works
correctly in that with the middle button down objects can be moved
around. With the Sun mouse the pointer freezes with the middle button down.

In nedit, with the PC mouse pointer on the scroll thingy on the side the
text smooth scrolls. With the Sun mouse the text jump scrolls one line
at a time.

The problem seems to be that movement info. is not being sent or is
incorrect when the middle button is down. The inputattach program
appears to be decoding the mouse protocol so I think that is where the
problem is. I am not a C programmer so I can't determine what is wrong.

Best regards,
Fred