:: Re: [DNG] mouse driver question
Startseite
Nachricht löschen
Nachricht beantworten
Autor: karl
Datum:  
To: dng
Betreff: Re: [DNG] mouse driver question
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