Mouse in console with usbhid active

I have a cherry keyboard with multimedia keys, I activated usbhid and configured usbhidaction so that the
multimedia keys could work under X11. Since then, the mouse doesn't work in the console.

in /boot/loader.conf I add these two lines to active usbhid :

Code:
  usbhid_load="YES"
  hw.usb.usbhid.enable=1

How can I get the mouse to work in the console when usbhid is active?
 
According to this thread : https://forums.FreeBSD.org/threads/usb-mouse-not-working.64262/post-373633

USB mice it's automatically loaded by devd(8)(). If it's correctly recognized.

In /etc/devd/moused.conf I can see :

Code:
notify 100 {
  match "system" "DEVFS";
  match "subsystem" "CDEV";
  match "type" "CREATE";
  match "cdev" "ums[0-9]+";

  action "service moused quietstart $cdev";
};
notify 100 {
  match "system" "DEVFS";
  match "subsystem" "CDEV";
  match "type" "DESTROY";
  match "cdev" "ums[0-9]+";

  action "service moused stop $cdev";
};

So moused also supports usb mice.
In this file I don't see any rule for usbhid device management.

So I did these tests in the console as my mouse is recognized through port /dev/ugen2.3 :

Code:
$ usbconfig show_ifdrv
ugen3.2: <Cherry GmbH CHERRY Corded Device> at usbus3, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen3.2.0: usbhid0: <Cherry GmbH CHERRY Corded Device, class 0/0, rev 2.00/3.03, addr 2>
ugen3.2.1: usbhid1: <Cherry GmbH CHERRY Corded Device, class 0/0, rev 2.00/3.03, addr 2>
ugen2.3: <PixArt USB Optical Mouse> at usbus2, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen2.3.0: usbhid2: <PixArt USB Optical Mouse, class 0/0, rev 1.10/1.00, addr 3>

# service moused quietstart ugen2.3
eval: ${moused_ugen2....}: Bad substitution

# moused -p /dev/ugen2.3 -t auto -i all
moused: unable to get status of mouse fd: Inappropriate ioctl for device
moused: cannot determine mouse type on /dev/ugen2.3
/dev/ugen2.3 unknown unknown generic

It seems that moused cannot read usbhid ports.
 
In-base moused does not support evdev protocol, only sysmouse one. And no usbhid descendants support sysmouse.
https://github.com/wulf7/moused is what you are looking for. Unfortunately, I have no enough spare time to complete refactoring of code from early 90 to commit it in to the base.
Thank you for your reply.
I'll try the solution you suggested.
If there's anything I can do to help, don't hesitate to ask.
 
The proposed solution works perfectly.

For those who are interested, I have written a script to automate the procedure (if you have sudo, you must replace all doas with sudo):

sh:
#!/usr/bin/env sh
echo "1-Download moused"
git clone https://github.com/wulf7/moused /tmp/moused
echo "2-Build moused"
cd /tmp/moused/
make
echo "3-Install moused"
doas make install
echo "4-Disable moused in /etc/rc.conf"
doas sed -i '' 's~^\(moused_enable\)~#\1~' /etc/rc.conf
echo "5-Activate moused at startup in /etc/rc.local"
echo 'vidcontrol -m on
for file in /dev/input/event[0-9]*; do
        /usr/local/sbin/moused -p $file -I /var/run/moused.`echo $file | cut -c 12-`.pid
done' | doas tee -a /etc/rc.local

Save this script in the location of your choice.
Make it executable, then run it.

Reboot and the mouse works in the console with usbhid.
 
Back
Top