Re: Re. Mouse / typo

From: Michele Andreoli (m.andreoli@tin.it)
Date: Mon May 06 2002 - 14:27:43 CEST


On Sun, May 05, 2002 at 07:13:10PM -0400, Alfie Costa wrote:
Content-Description: Mail message body
> On 3 May 2002, at 14:58, Michele Andreoli <mulinux@sunsite.dk> wrote:
>
> > out=`dd if=/dev/mouse bs=3c count=1`
>
> "bs=3c"? 3c hex = 60 dec. 3c is 57 chars too many. Fix:
>
> out=`dd if=/dev/mouse bs=3 count=1`
>

On my system, "3c" is interpreted as "3 char". I did that:

                # dd if=/dev/zero of=scaz bs=1c count=1
                # ls -l scaz
>>> root root 3 May 6 14:16 scaz

> More notes...
>
> /dev/mouse also captures mouse movements.

Right. It captures each mouse event.

>
> The above method of assigning the shell variable $out loses any nulls.
>
> 'dd' outputs unwanted stuff to stderr.

This can be corrected with:

         out0=`dd if=/dev/mouse bs=1c count=1 2>/dev/null`
         out1=`dd if=/dev/mouse bs=1c count=1 2>/dev/null`
         out2=`dd if=/dev/mouse bs=1c count=1 2>/dev/null`

After that, you must decide the kind of the event using bit-to-bit operations,
on out[].

But this is only accademic!
It is NOT possible to manage the mouse using shell script; only the bare
event "there is a mouse activity" is interceptable.

If only mouse activity is required, you can also watch the file /proc/interrupts:
the number of interrupts related to psaux changes when you touch the mouse
(I used this method in muLinux in order to configure the mouse: serial or PS2).

>
> Attached is a variant of your script. It uses 'hexd' to show the output from
> /dev/mouse.
>

Content-Description: Text from file 'mouseclick.sh'
> #!/bin/sh
> # A variant of Michele's mouse output routine. -AC Sun May 5 19:00 EDT 2002
> # Requires the muLinux 'hexd' util.
>

Perfect. hexd is a very wonderfull mu utility (I use it also in my Linux
box).

Another variant:
                
                # out0=`poke /dev/mouse 0`
                # out1=`poke /dev/mouse 1`
                # out2=`poke /dev/mouse 2`

Both uses not standard (muLinux only) utility: poke ad hexd.

Michele

-- 
I keep trying to locate a meeting of Quantum Physicists. But everytime
they set a meeting time, the location changes. And vice versa -- Anonymous
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.dk
For additional commands, e-mail: mulinux-help@sunsite.dk


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:22 CET