On Friday 01 August 2003 11:00, Andrey Borzenkov wrote:
[..]
> > > You do not have direct access to hardware anymore. What you can get
> > > for mouse is either /dev/psaux or /dev/input/mouseN that is EMULATED
> > > Microsoft Intellimouse for ANY mouse-like backed available or event
> > > interface /dev/input/eventN.
> >
> > does this mean mouse configuration in XFree will always be:
> >
> > Section "InputDevice"
> > Identifier "Mouse1"
> > Driver "mouse"
> > Option "Protocol" "IMPS/2"
> > Option "Device" "/dev/input/mice"
> > EndSection
> >
> > when linux 2.4 compatibility is no more a pb?
> > (or only choose Emulate3Buttons or not)
>
> mmmm ... yes,
... if we forget about serial (com port) mice.
With these the situation is as following.
If you want to access them via input subsystem (/dev/input/mice or mouseN) you
have to manually setup corr. serial port telling it mous type. There is no
plug'n'play, autodetection or whatever. Then your program must read from the
serial port, and this read blocks until mouse driver is active. Example
program is (definitions taken directly from 2.6 include/linux/serio.h, it is
likely not all termios flags are really needed):
======= cut here ============
#include <linux/termios.h>
#include <linux/fcntl.h>
#define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
#define SERIO_PROTO 0xFFUL
#define SERIO_MSC 0x01
#define SERIO_SUN 0x02
#define SERIO_MS 0x03
#define SERIO_MP 0x04
#define SERIO_MZ 0x05
#define SERIO_MZP 0x06
#define SERIO_MZPP 0x07
#define SERIO_SUNKBD 0x10
#define SERIO_WARRIOR 0x18
#define SERIO_SPACEORB 0x19
#define SERIO_MAGELLAN 0x1a
#define SERIO_SPACEBALL 0x1b
#define SERIO_GUNZE 0x1c
#define SERIO_IFORCE 0x1d
#define SERIO_STINGER 0x1e
#define SERIO_NEWTON 0x1f
#define SERIO_STOWAWAY 0x20
#define SERIO_H3600 0x21
#define SERIO_PS2SER 0x22
#define SERIO_TWIDKBD 0x23
#define SERIO_TWIDJOY 0x24
#define SERIO_HIL 0x25
#define SERIO_SNES232 0x26
#define SERIO_SEMTECH 0x27
#define SERIO_RS232 0x02000000UL
#define SERIO_EXTRA 0xff0000UL
#define BTN_MIDDLE 0x00010000UL
#define REL_WHEEL 0x00100000UL
main ()
{
int ldisc = 2;
unsigned long type = SERIO_RS232 | SERIO_MZ | BTN_MIDDLE | REL_WHEEL ;
int fd = open("/dev/ttyS0", O_RDONLY, 0);
char buf[10];
struct termios t;
t.c_iflag = (IGNBRK|IGNPAR);
t.c_oflag = (NL0|CR0|TAB0|BS0|VT0|FF0);
t.c_cflag = (CS7|HUPCL|CREAD|CLOCAL);
t.c_lflag = 0;
cfsetospeed(&t, B1200);
cfsetispeed(&t, 0);
tcsetattr(fd, TCSANOW, &t);
ioctl(fd, TIOCSETD, &ldisc);
ioctl(fd, SPIOCSTYPE, &type);
read(fd, buf, 1);
}
============== cut here ====================
then you do
cc -o mouseport mouseport.c
./mouseport &
modprobe sermouse
(this assumes of coure you have driver for your serial port)
and voi la - you have second mouse at com1. In this case it was Genius
NetScroll+ and - even middle button and wheel are working! :) Even if it
calls itself
input: Microsoft MZ Mouse on ttyS0/serio0
serio: Serial port ttyS0
I do not have the slightest idea how to implement it currently. Note, that
there is no way to use hotplug or similar because you MUST use external
program to set corret tty ldisc - only after that does device appears for
input layer. And you have to tell it correct number of buttons (up to 5 are
supported) and whether it has wheel like example program does.
just to add to confusion :)))
-andrey