From: Stuart Henderson Subject: patch: pixart mice repeatedly reconnecting if x isn't running To: tech@openbsd.org Date: Thu, 22 Aug 2024 11:30:15 +0100 There's a known firmware bug in some mice where, if the device isn't polled regularly, something overflows and the device disconnects and reattaches. It's quite painful if you have machines in locations where you need help to give you information after a startup failure (e.g. failing fsck or X not starting for whatever reason), as any useful information soon gets replaced with this spam wsmouse0 detached ums0 detached uhidev0 detached uhidev0 at uhub0 port 3 configuration 1 interface 0 "PixArt Microsoft USB Optical Mouse" rev 1.10/1.00 addr 2 uhidev0: iclass 3/1 ums0 at uhidev0: 3 buttons, Z dir wsmouse0 detached ums0 detached uhidev0 detached uhidev0 at uhub0 port 3 configuration 1 interface 0 "PixArt Microsoft USB Optical Mouse" rev 1.10/1.00 addr 2 uhidev0: iclass 3/1 ums0 at uhidev0: 3 buttons, Z dir wsmouse0 detached ums0 detached uhidev0 detached uhidev0 at uhub0 port 3 configuration 1 interface 0 "PixArt Microsoft USB Optical Mouse" rev 1.10/1.00 addr 2 uhidev0: iclass 3/1 ums0 at uhidev0: 3 buttons, Z dir (etc.) It seems that jcs and kurt figured out a related problem with the Surface Type Cover and added UQ_ALWAYS_OPEN in 2021 which is similar to linux HID_QUIRK_ALWAYS_POLL and NetBSD UQ_ALWAYS_ON that work around this problem. Here's a diff to add UQ_ALWAYS_OPEN for the mouse I'm having problems with (confirmed to work, and to not affect normal mouse use), plus the devices currently listed in NetBSD. OK? (obviously needs 'make' in dev/usb if testing). Index: usb_quirks.c =================================================================== RCS file: /cvs/src/sys/dev/usb/usb_quirks.c,v diff -u -p -r1.78 usb_quirks.c --- usb_quirks.c 24 Mar 2021 02:49:57 -0000 1.78 +++ usb_quirks.c 22 Aug 2024 10:23:11 -0000 @@ -154,12 +154,24 @@ const struct usbd_quirk_entry { ANY, { UQ_MS_VENDOR_BUTTONS }}, /* Devices that need their data pipe held open */ + { USB_VENDOR_CHICONY, USB_PRODUCT_CHICONY_OPTMOUSE, + ANY, { UQ_ALWAYS_OPEN }}, { USB_VENDOR_HAILUCK, USB_PRODUCT_HAILUCK_KEYBOARD, ANY, { UQ_ALWAYS_OPEN }}, + { USB_VENDOR_LENOVO, USB_PRODUCT_LENOVO_OPTUSBMOUSE, + ANY, { UQ_ALWAYS_OPEN }}, + { USB_VENDOR_LOGITECH USB_PRODUCT_LOGITECH_B100_1, + ANY, { UQ_ALWAYS_OPEN }}, + { USB_VENDOR_LOGITECH USB_PRODUCT_LOGITECH_B100_2, + ANY, { UQ_ALWAYS_OPEN }}, + { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_PIXARTMOUSE, + ANY, { UQ_ALWAYS_OPEN }}, { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_TYPECOVER, - ANY, { UQ_ALWAYS_OPEN }}, + ANY, { UQ_ALWAYS_OPEN }}, { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_TYPECOVER2, - ANY, { UQ_ALWAYS_OPEN }}, + ANY, { UQ_ALWAYS_OPEN }}, + { USB_VENDOR_PIXART, USB_PRODUCT_PIXART_RPIMOUSE, + ANY, { UQ_ALWAYS_OPEN }}, { 0, 0, 0, { 0 } } }; Index: usbdevs =================================================================== RCS file: /cvs/src/sys/dev/usb/usbdevs,v diff -u -p -r1.767 usbdevs --- usbdevs 8 Aug 2024 05:09:09 -0000 1.767 +++ usbdevs 22 Aug 2024 10:23:11 -0000 @@ -365,6 +365,7 @@ vendor GARMIN 0x091e Garmin Internation vendor GOHUBS 0x0921 GoHubs vendor BIOMETRIC 0x0929 American Biometric Company vendor TOSHIBA 0x0930 Toshiba Corp +vendor PIXART 0x093a PixArt vendor INTREPIDCS 0x093c Intrepid vendor YANO 0x094f Yano vendor KINGSTON 0x0951 Kingston Technology @@ -1347,6 +1348,7 @@ product CHIC CYPRESS 0x0003 Cypress /* Chicony products */ product CHICONY KB8933 0x0001 KB-8933 keyboard +product CHICONY OPTMOUSE 0x0939 Optical Mouse product CHICONY CAMERA 0x480c Integrated Camera product CHICONY RTL8188CUS_1 0xaff7 RTL8188CUS product CHICONY RTL8188CUS_2 0xaff8 RTL8188CUS @@ -2638,6 +2640,7 @@ product LENOVO RTL8153B_2 0x3098 RTL8153 product LENOVO RTL8153B_3 0x309b RTL8153B product LENOVO RTL8153B_4 0x309c RTL8153B product LENOVO RTL8153B_5 0x309d RTL8153B +product LENOVO OPTUSBMOUSE 0x600e Optical Mouse product LENOVO ETHERNET 0x7203 USB 2.0 Ethernet product LENOVO RTL8153_1 0x7205 RTL8153 product LENOVO ONELINK 0x720a OneLink @@ -2753,6 +2756,8 @@ product LOGITECH MBA47 0xc002 M-BA47 mo product LOGITECH WMMOUSE 0xc004 WingMan Gaming Mouse product LOGITECH BD58 0xc00c BD58 mouse product LOGITECH UN58A 0xc030 iFeel Mouse +product LOGITECH B100_1 0xc05a B100 mouse +product LOGITECH B100_2 0xc077 B100 mouse product LOGITECH WMPAD 0xc208 WingMan GamePad Extreme product LOGITECH WMRPAD 0xc20a WingMan RumblePad product LOGITECH WMJOY 0xc281 WingMan Force joystick @@ -3139,6 +3144,7 @@ product MICROSOFT INETPRO 0x001c Interne product MICROSOFT TBEXPLORER 0x0024 Trackball Explorer product MICROSOFT INTELLIEYE 0x0025 IntelliEye mouse product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro +product MICROSOFT PIXARTMOUSE 0x00cb Optical Mouse product MICROSOFT MN510 0x006e MN510 Wireless product MICROSOFT 700WX 0x0079 Palm 700WX product MICROSOFT MN110 0x007a 10/100 Ethernet @@ -3599,6 +3605,10 @@ product PILOTECH CRW600 0x0001 CRW-600 /* Pioneer DJ products */ product PIONEERDJ RTL8152B 0x0007 RTL8152B product PIONEERDJ RTL8153B 0x0031 RTL8153B + +/* PixArt products */ + +product PIXART RPIMOUSE 0x2510 Raspberry Pi Mouse /* Planex Communications products */ product PLANEX GW_US11H 0x14ea GW-US11H WLAN