Re: iichid/hms keyboard/mouse wrongly reattached to uhid/ums

From: Vladimir Kondratyev <vladimir_at_kondratyev.su>
Date: Mon, 27 Jun 2022 16:58:14 UTC
On 27.06.2022 18:19, Ivan Quitschal wrote:
> Hi all
> 
> Not sure if I found a problem here but here we go.
> 
> Since I have a KVM usb switch here for keyboard/mouse sometimes I toggle it 
> between my windows and freebsd.
> 
> I am using iichid here to have my multimedia keys working on keyboard and all
> 
> hw.usb.usbhid.enable="1"
> 
> Im also using Wulf’s moused
> 
> https://github.com/wulf7/moused <https://github.com/wulf7/moused>
> 
> so far so good. Problem is:
> 
> when I switch to windows , everything is detached correctly (hms, hkbd etc), but 
> when I switch back, sometimes
> 
> the keyboard and mouse are wrongly attached to “ums” device , not hms. 
> (sometimes it goes to the correct one).
> 
> Shouldn’t ums/uhid modules be deactivated once hw.usb.usbhid.enable is set to 1 ?
> 
> The workaround I did here was to manually kldunload both uhid.ko and ums.ko 
> within rc.local during boot.
> 
> This way I can detache attach the kbd/mouse back as much as I want and it always 
> end up in hms/hkbd devices
> 
> Is this how its supposed to function? Randomly choosing between ums or hms?
> 
> Thanks
> 
> --tzk

It seems that usbhid's bus probe priority must be increased from
BUS_PROBE_GENERIC + 1 to BUS_PROBE_DEFAULT + 1

Test this patch:

diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c
index fe53f11b8f4..174e1c28ae9 100644
--- a/sys/dev/usb/input/usbhid.c
+++ b/sys/dev/usb/input/usbhid.c
@@ -802,7 +802,7 @@ usbhid_probe(device_t dev)
  	if (hid_test_quirk(&sc->sc_hw, HQ_HID_IGNORE))
  		return (ENXIO);

-	return (BUS_PROBE_GENERIC + 1);
+	return (BUS_PROBE_DEFAULT + 1);
  }

  static int



-- 
WBR
Vladimir Kondratyev