From nobody Mon Jun 27 15:37:02 2022 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DACCF86C53A for ; Mon, 27 Jun 2022 15:37:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LWsKk2X5bz4ZQf for ; Mon, 27 Jun 2022 15:37:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x931.google.com with SMTP id o21so3574234uat.6 for ; Mon, 27 Jun 2022 08:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ocA72TYs9gaVLFziT5UEE9Lcac8YJNqH00yJFB2xjOw=; b=sAqsWPF5BsSbdCEFvzhwBGgmWrmxv7pxzAH6r8qRxC5WbNBjRcxE7jvWtiapXNfSl+ /CZBQwPcLwmDUGgEntWnT8beTGzDk/NXOmXFUFoJGJ2UoeqTiNY8p1ZvsNzsg0zDzrQ0 YXAywtIWA3pEyOV0e3m8UTPGJ2vn1pmLqcRrTRx1pC4+wY5+aw3StZaTRk8hxx+olL9z cBS6WyfUpNNxMEs9mShZQ01ZY/gpiMHTaAMOEwwVZ1ahr/5rxZtJ74ktCk+s4Y0xzyft P2J5YC+hTIn1tu5+w+zCBdBi6Xt5Er9Q5oq4EARl7fKjEFfa2xcMXxxeOoPDxD0QFflw SYrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ocA72TYs9gaVLFziT5UEE9Lcac8YJNqH00yJFB2xjOw=; b=AT2s85jAgN8ldJ/qqUZwOVFL49XPowjPZ+Hsk5A4tNOY1sEZ40Zo0UY5O5L9kikqcg a23dQx4MnIU1tR+VM4XEXQ0/cBI/aklnZUrASeaQVKkjRCr6X9JgvQBOFMm/dr0GKw3P o+JYEKqdiwlV15BsrHFF0IH3ijsIvOGXczLthU9aP6orLgwlQqMQVrCA4xYB6W8J9keT a553LOmAlblHh6GcJb2kQLvxjq6vgSKXI6MLqQU63FMwF4MOnTteTXtq6CfbLGEiZHH+ VRkUDSe559LuuGz+eyyy3PEpdj+rWkhIrHT5pp7AWNYTzfEoXVdP54yA2nQ7cvD7FZY6 /0Pw== X-Gm-Message-State: AJIora/LnnUIogH0NoxVw6srwFy9QAdlQT9Zr1ZhGyAafTXQWu/6zL1E xl3ynnnMaE5qzmZMYRa8Krl4yEsnbNeXA8677WURYCnPpQM= X-Google-Smtp-Source: AGRyM1vJG6WEc6P4R5+tEtHPdZvwXPwE/8CdLn0g9r7MVrdR992Q9t8jdvJt45GL5OSr5oCenJUPsvk2ccGmW8o0BW8= X-Received: by 2002:ab0:764c:0:b0:37e:ff9f:4d27 with SMTP id s12-20020ab0764c000000b0037eff9f4d27mr4799596uaq.24.1656344233752; Mon, 27 Jun 2022 08:37:13 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 References: <420b1f58-09c4-6876-b1ad-91751c60e83c@selasky.org> In-Reply-To: <420b1f58-09c4-6876-b1ad-91751c60e83c@selasky.org> From: Warner Losh Date: Mon, 27 Jun 2022 09:37:02 -0600 Message-ID: Subject: Re: iichid/hms keyboard/mouse wrongly reattached to uhid/ums To: Hans Petter Selasky Cc: Ivan Quitschal , "freebsd-current@freebsd.org" , "wulf@freebsd.org" Content-Type: multipart/alternative; boundary="000000000000add41b05e26fb199" X-Rspamd-Queue-Id: 4LWsKk2X5bz4ZQf X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=sAqsWPF5; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::931) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::931:from]; MLMMJ_DEST(0.00)[freebsd-current]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_SPF_NA(0.00)[no SPF record]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_CC(0.00)[hotmail.com,freebsd.org] X-ThisMailContainsUnwantedMimeParts: N --000000000000add41b05e26fb199 Content-Type: text/plain; charset="UTF-8" On Mon, Jun 27, 2022 at 9:27 AM Hans Petter Selasky wrote: > On 6/27/22 17: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 > > 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? > > > > Hi, > > Can you dump "kldstat" at the different times? > > I guess it may be just be that the wrong module is loaded first, so it > grabs the device, because there are no other drivers loaded, even though > ums is a generic driver. > > Try loading all relevant drivers in /boot/loader.conf . Then the attach > order shouldn't matter. > We should fix the priority of the two drivers if the order matters... Another possibility is that the ums is loaded and hms isn't so ums wins. If any device wins, devmatch isn't invoked to load possible drivers.. Warner --000000000000add41b05e26fb199 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Mon, Jun 27, 2022 at 9:27 AM Hans = Petter Selasky <hps@selasky.org&g= t; wrote:
On 6/2= 7/22 17: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 togg= le 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=3D"1"
>
> Im also using Wulf's 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.enabl= e is set to 1 ?
>
> The workaround I did here was to manually kldunload both uhid.ko and u= ms.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?
>

Hi,

Can you dump "kldstat" at the different times?

I guess it may be just be that the wrong module is loaded first, so it
grabs the device, because there are no other drivers loaded, even though ums is a generic driver.

Try loading all relevant drivers in /boot/loader.conf . Then the attach order shouldn't matter.

We should f= ix the priority of the two drivers if the order matters...

Another possibility is that the ums is loaded and hms isn't so= ums wins. If any device wins, devmatch isn't invoked to load possible = drivers..

Warner
--000000000000add41b05e26fb199--