Cordless mouse

From: <charlysquare_at_altern.org>
Date: Tue, 6 Apr 2004 13:26:53 +0200 (CEST)
Hi,

I've got a Cordless combo Mouse/keyboard Memorex RF7000, my keyboard is 
detected, but the mouse don't want to move.. i've tested it under knoppix or 
windows, and it works ! but under FreeBSD 5.2, i can't manage to move the 
cursor..

I've been helped by Soren Schmidt 'til now, here is what he adviced me :

1. ----------------------------------------------
-------------------------------------------------

I use the following hack with a wireless Fujitsu-Siemens USB kbd+mouse 
here, maybe that helps..




Index: hid.c
===================================================================
  u_long
  hid_get_data(u_char *buf, struct hid_location *loc)
  {
-       u_int hpos = loc->pos;
+       u_int hpos = loc->pos - 40;;
         u_int hsize = loc->size;
         u_int32_t data;
         int i, s;

Index: ums.c
===================================================================
                 ret = UMATCH_NONE;

         free(desc, M_TEMP);
-       return (ret);
+       return (UMATCH_IFACECLASS);
  }

  USB_ATTACH(ums)


2. ----------------------------------------------
-------------------------------------------------

> dmesg | grep ums return ums0 so this is good
> ps ax|grep moused return :
> /usr/sbin/moused -p /dev/ums0 so this is great.. >but...the mouse is not 
moving at all... 

OK, then back out this part of the patch, that might not be needed for 
your mouse (mine has several buttons and wheels and what not :) )

 > >   hid_get_data(u_char *buf, struct hid_location *loc)
 > >   {
 > > -       u_int hpos = loc->pos;
 > > +       u_int hpos = loc->pos - 40;;
 > >          u_int hsize = loc->size;
 > >          u_int32_t data;
 > >          int i, s;
 > >

3. ----------------------------------------------
-------------------------------------------------

> I've rebuild my kernel, but the cursor is not moving... 

Hmm then the mouse is probably using a new variation of the protocol 
(mine does hence the first patch). I guess that will need further 
investigation to find out how it sends its position info, there are some 
  debugging code in there that can be of use, but if you are not a 
programmer it will probably be a bit difficult todo...

4. ----------------------------------------------
-------------------------------------------------

I used the below patch to find out how the position info looked 
from my mouse/kbd combo, use it with debug defined in ums.c.
Looking at the output when moving the mouse might help you to find out 
what your does.

Hope that helps you further along...

Index: ums.c
===================================================================

  #define UMS_BUT(i) ((i) < 3 ? (((i) + 2) % 3) : (i))

         DPRINTFN(5, ("ums_intr: sc=%p status=%d\\\\n", sc, status));
-       DPRINTFN(5, ("ums_intr: data = %02x %02x %02x\\\\n",
-                    sc->sc_ibuf[0], sc->sc_ibuf[1], sc->sc_ibuf[2]));
+       DPRINTFN(5, ("ums_intr: data = "));
+       for (i=0; i<sc->sc_isize; i++)
+               DPRINTFN(5, ("%02x ", sc->sc_ibuf[i]));
+       DPRINTFN(5, ("\\\\n"));

         if (status == USBD_CANCELLED)
                 return;


---------------------------------------------------------
--------->>>> at this point, i didn't know where to search to find the mouse 
position... 

So i saw another mail, and tried this solution :

1/first i build my kernel back to the original configuration except the first 
modification in ums.c that Soren Schmidt adviced me (it enables moused)

2/i added #define USB_DEBUG to src/sys/dev/usb/usb.h, (as said in 
http://lists.freebsd.org/pipermail/freebsd-current/2004-January/018057.html & 
http://lists.freebsd.org/pipermail/freebsd-current/2004-March/023083.html)
then i rebuild & reinstall my kernel.

3/i did that : sysctl hw.usb.ums.debug=15, and (re)attach the USB device.

4/ the resulting "ums_attach:..." messages from dmesg here :

ukbd0: BTC USB Multimedia Cordless Kit, rev 1.10/1.30, addr 2, iclass 3/1
kdb0 at ukbd0
ums0: BTC USB Multimedia Cordless Kit, rev 1.10/1.30, addr 2, iclass 3/1
ums_attach: bLength=7 bDescriptorType=5 bEndpointAddress=2-in bmAttributes=3 
wMaxPacketSize=6 bInterval=14
ums0: 5 buttons and Z dir.
ums_attach: sc=0xc68bac00
ums_attach: X   80/8
ums_attach: Y   88/8
ums_attach: Z   96/8
ums_attach: B1  72/1
ums_attach: B2  73/1
ums_attach: B3--74/1--------------------------------
ums_attach: B4  75/1
ums_attach: B5  76/1
ums_attach: size=14, id=4

Could you help me please ?

Many thanks

------------

killall -9 moused
ums_intr: sc=0xc68bac00 status=6
ums_intr: data = db 39 39
----
cat /dev/ums0

ums_intr: x:0 y:0 z:0 buttons:0x0
ums_intr: sc=0xc68bac00 status=6
ums_intr: data = 04 00 00

ums_intr: data = 10 02 05 f3 c0 a8 01 01 00 00 00 00 00 00

with cat /dev/ums0 

click on the top_right button :
ums_intr: data: 04 02 00 00 00 a8 01 01 00 00 00 00 00 00
click on the top_left button :
ums_intr: data: 04 01 fe ff 00 a8 01 01 00 00 00 00 00 00
click on the side_right button :
ums_intr: data: 04 10 fe ff 00 a8 01 01 00 00 00 00 00 00
click on the side_left button :
ums_intr: data: 04 08 fe ff 00 a8 01 01 00 00 00 00 00 00
click on the wheel :
ums_intr: data: 04 04 00 00 00 a8 01 01 00 00 00 00 00 00
rolling up the wheel:
ums_intr: data: 04 00 00 00 01 a8 01 01 00 00 00 00 00 00
rolling down the wheel:
ums_intr: data: 04 00 00 00 ff a8 01 01 00 00 00 00 00 00
moving the mouse :
ums_intr: data: 04 00 fe ff 00 a8 01 01 00 00 00 00 00 00
ums_intr: data: 04 00 ff fe 00 a8 01 01 00 00 00 00 00 00
ums_intr: data: 04 00 02 ff 00 a8 01 01 00 00 00 00 00 00
ums_intr: data: 04 00 05 ff <-- those are changing, etc..
Received on Tue Apr 06 2004 - 02:46:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:50 UTC