Re: usb mouse not work on boot

2024-05-18 Thread Chris

On 2024-05-18 08:33, Warner Losh wrote:

On Sat, May 18, 2024, 9:22 AM Oleksandr Kryvulia 
wrote:


18.05.24 16:06, Warner Losh:



On Sat, May 18, 2024, 6:51 AM Oleksandr Kryvulia 
wrote:


18.05.24 12:59, Oleksandr Kryvulia:

18.05.24 12:55, Dag-Erling Smørgrav:

Oleksandr Kryvulia   
writes:


Gary Jennejohn   writes:

Try adding uhid_load="YES" to your /boot/loader.conf.  With that
added the module should be automatically loaded during the kernel
boot.

As workaround I already have kld_list+="uhid" in /etc/rc.conf.

I hope you don't mean that literally, because /etc/rc.conf is a shell
script and += is not valid shell syntax.  On the other hand, something
like

kld_list="${kld_list} uhid"

Yes, you are right. I mean
sysrc kld_list+="uhid"


One more correction. Via kld_list I need load ums(4), loading only
uhid(4) does not solve a problem.




You don't need to change kld_list. In fact, you should undo any changes
you've made there. Undo everything in loader.conf you've done.

This is a bug in the boot optimization stuff. Or rather, this exposes a
long standing bug in the USB code where there's an asymmetry between the
nomatch events and the bus tree it presents to devctl causing devmatch to
fail when the nomatch events aren't present on boot.

Just set hw.bus.devctl_nomatch_enabled=1 in /boot/loader.conf and reboot.
Or update to the change I'm about to make.


Thanks for the detailed explanation, Warner. Interesting that on my system
hw.bus.devctl_nomatch_enabled=1 is set by /etc/rc.d/devmatch but only
explicit set it in /boot/loader.conf did the trick. That is why I think
this sysctl don't work in my case.



Yea. That's the optimization. We don't start generating events until it is
one. Setting it in the bootloader causes all events to coke through.
Setting it in devmatch turns them on after we run devmatch the first time,
omitting all of the ones generated on boot.

Why is sysctl.conf(5) not the best location for this?



Warner




--Chris



Re: usb mouse not work on boot

2024-05-18 Thread Warner Losh
On Sat, May 18, 2024, 9:22 AM Oleksandr Kryvulia 
wrote:

> 18.05.24 16:06, Warner Losh:
>
>
>
> On Sat, May 18, 2024, 6:51 AM Oleksandr Kryvulia 
> wrote:
>
>> 18.05.24 12:59, Oleksandr Kryvulia:
>>
>> 18.05.24 12:55, Dag-Erling Smørgrav:
>>
>> Oleksandr Kryvulia   writes:
>>
>> Gary Jennejohn   writes:
>>
>> Try adding uhid_load="YES" to your /boot/loader.conf.  With that
>> added the module should be automatically loaded during the kernel
>> boot.
>>
>> As workaround I already have kld_list+="uhid" in /etc/rc.conf.
>>
>> I hope you don't mean that literally, because /etc/rc.conf is a shell
>> script and += is not valid shell syntax.  On the other hand, something
>> like
>>
>> kld_list="${kld_list} uhid"
>>
>> Yes, you are right. I mean
>> sysrc kld_list+="uhid"
>>
>>
>> One more correction. Via kld_list I need load ums(4), loading only
>> uhid(4) does not solve a problem.
>>
>
>
> You don't need to change kld_list. In fact, you should undo any changes
> you've made there. Undo everything in loader.conf you've done.
>
> This is a bug in the boot optimization stuff. Or rather, this exposes a
> long standing bug in the USB code where there's an asymmetry between the
> nomatch events and the bus tree it presents to devctl causing devmatch to
> fail when the nomatch events aren't present on boot.
>
> Just set hw.bus.devctl_nomatch_enabled=1 in /boot/loader.conf and reboot.
> Or update to the change I'm about to make.
>
>
> Thanks for the detailed explanation, Warner. Interesting that on my system
> hw.bus.devctl_nomatch_enabled=1 is set by /etc/rc.d/devmatch but only
> explicit set it in /boot/loader.conf did the trick. That is why I think
> this sysctl don't work in my case.
>

Yea. That's the optimization. We don't start generating events until it is
one. Setting it in the bootloader causes all events to coke through.
Setting it in devmatch turns them on after we run devmatch the first time,
omitting all of the ones generated on boot.

Warner

>


Re: usb mouse not work on boot

2024-05-18 Thread Oleksandr Kryvulia

18.05.24 16:06, Warner Losh:



On Sat, May 18, 2024, 6:51 AM Oleksandr Kryvulia 
 wrote:


18.05.24 12:59, Oleksandr Kryvulia:

18.05.24 12:55, Dag-Erling Smørgrav:

Oleksandr Kryvulia   
 writes:

Gary Jennejohn    writes:

Try adding uhid_load="YES" to your /boot/loader.conf.  With that
added the module should be automatically loaded during the kernel
boot.

As workaround I already have kld_list+="uhid" in /etc/rc.conf.

I hope you don't mean that literally, because /etc/rc.conf is a shell
script and += is not valid shell syntax.  On the other hand, something
like

kld_list="${kld_list} uhid"

Yes, you are right. I mean
sysrc kld_list+="uhid"


One more correction. Via kld_list I need load ums(4), loading only
uhid(4) does not solve a problem.



You don't need to change kld_list. In fact, you should undo any 
changes you've made there. Undo everything in loader.conf you've done.


This is a bug in the boot optimization stuff. Or rather, this exposes 
a long standing bug in the USB code where there's an asymmetry between 
the nomatch events and the bus tree it presents to devctl causing 
devmatch to fail when the nomatch events aren't present on boot.


Just set hw.bus.devctl_nomatch_enabled=1 in /boot/loader.conf and 
reboot. Or update to the change I'm about to make.




Thanks for the detailed explanation, Warner. Interesting that on my 
system hw.bus.devctl_nomatch_enabled=1 is set by /etc/rc.d/devmatch but 
only explicit set it in /boot/loader.conf did the trick. That is why I 
think this sysctl don't work in my case.

Re: usb mouse not work on boot

2024-05-18 Thread Warner Losh
On Sat, May 18, 2024 at 6:51 AM Oleksandr Kryvulia 
wrote:

> 18.05.24 12:59, Oleksandr Kryvulia:
>
> 18.05.24 12:55, Dag-Erling Smørgrav:
>
> Oleksandr Kryvulia   writes:
>
> Gary Jennejohn   writes:
>
> Try adding uhid_load="YES" to your /boot/loader.conf.  With that
> added the module should be automatically loaded during the kernel
> boot.
>
> As workaround I already have kld_list+="uhid" in /etc/rc.conf.
>
> I hope you don't mean that literally, because /etc/rc.conf is a shell
> script and += is not valid shell syntax.  On the other hand, something
> like
>
> kld_list="${kld_list} uhid"
>
> Yes, you are right. I mean
> sysrc kld_list+="uhid"
>
>
> One more correction. Via kld_list I need load ums(4), loading only uhid(4)
> does not solve a problem.
>

Also, in this case, kld_list is a terrible place to load the files. You're
better off loading them with xxx_load=YES in loader.conf. The reason is
that both uhid and ums will match your mouse. kld_list loads these in a
random order (effectively) and the first one to load will claim the device,
since there's no re-probe when the next one loads. You should never use it,
unless the module you're loading isn't supported by the boot loader (like
drm-kmod). The old advice was to put everything in kld_list and it would
speed up boot, but all the performance bugs in the boot loader have been
fixed by a combination of moving to UEFI (which is generally faster),
BIOSes with performance bugs disappearing 10 years ago and block caching
being added to the boot loader. It should almost always be empty or just
drm-mod these days (unless you somehow have special needs).

By adding uhid last to this list in this way, you're guaranteeing you'll
hit this bug because it's not after ums, and that things won't work.

Warner


Re: usb mouse not work on boot

2024-05-18 Thread Warner Losh
On Sat, May 18, 2024, 6:51 AM Oleksandr Kryvulia 
wrote:

> 18.05.24 12:59, Oleksandr Kryvulia:
>
> 18.05.24 12:55, Dag-Erling Smørgrav:
>
> Oleksandr Kryvulia   writes:
>
> Gary Jennejohn   writes:
>
> Try adding uhid_load="YES" to your /boot/loader.conf.  With that
> added the module should be automatically loaded during the kernel
> boot.
>
> As workaround I already have kld_list+="uhid" in /etc/rc.conf.
>
> I hope you don't mean that literally, because /etc/rc.conf is a shell
> script and += is not valid shell syntax.  On the other hand, something
> like
>
> kld_list="${kld_list} uhid"
>
> Yes, you are right. I mean
> sysrc kld_list+="uhid"
>
>
> One more correction. Via kld_list I need load ums(4), loading only uhid(4)
> does not solve a problem.
>


You don't need to change kld_list. In fact, you should undo any changes
you've made there. Undo everything in loader.conf you've done.

This is a bug in the boot optimization stuff. Or rather, this exposes a
long standing bug in the USB code where there's an asymmetry between the
nomatch events and the bus tree it presents to devctl causing devmatch to
fail when the nomatch events aren't present on boot.

Just set hw.bus.devctl_nomatch_enabled=1 in /boot/loader.conf and reboot.
Or update to the change I'm about to make.

Warner


Re: usb mouse not work on boot

2024-05-18 Thread Oleksandr Kryvulia

18.05.24 12:59, Oleksandr Kryvulia:

18.05.24 12:55, Dag-Erling Smørgrav:

Oleksandr Kryvulia  writes:

Gary Jennejohn  writes:

Try adding uhid_load="YES" to your /boot/loader.conf.  With that
added the module should be automatically loaded during the kernel
boot.

As workaround I already have kld_list+="uhid" in /etc/rc.conf.

I hope you don't mean that literally, because /etc/rc.conf is a shell
script and += is not valid shell syntax.  On the other hand, something
like

kld_list="${kld_list} uhid"

Yes, you are right. I mean
sysrc kld_list+="uhid"


One more correction. Via kld_list I need load ums(4), loading only 
uhid(4) does not solve a problem.


Re: usb mouse not work on boot

2024-05-18 Thread Oleksandr Kryvulia

18.05.24 12:55, Dag-Erling Smørgrav:

Oleksandr Kryvulia  writes:

Gary Jennejohn  writes:

Try adding uhid_load="YES" to your /boot/loader.conf.  With that
added the module should be automatically loaded during the kernel
boot.

As workaround I already have kld_list+="uhid" in /etc/rc.conf.

I hope you don't mean that literally, because /etc/rc.conf is a shell
script and += is not valid shell syntax.  On the other hand, something
like

kld_list="${kld_list} uhid"

Yes, you are right. I mean
sysrc kld_list+="uhid"

Re: usb mouse not work on boot

2024-05-18 Thread Dag-Erling Smørgrav
Oleksandr Kryvulia  writes:
> Gary Jennejohn  writes:
> > Try adding uhid_load="YES" to your /boot/loader.conf.  With that
> > added the module should be automatically loaded during the kernel
> > boot.
> As workaround I already have kld_list+="uhid" in /etc/rc.conf.

I hope you don't mean that literally, because /etc/rc.conf is a shell
script and += is not valid shell syntax.  On the other hand, something
like

kld_list="${kld_list} uhid"

should work, and is preferable to Gary's suggestion since loading
modules pre-boot is significantly slower and should only be done for
modules which are required to boot or mount the root filesystem, such as
zfs.

> But IMHO it some regression.

I agree, and 6437872c1d66 should be reverted until devmatch is capable
of loading uhid.

DES
-- 
Dag-Erling Smørgrav - d...@freebsd.org



Re: usb mouse not work on boot

2024-05-18 Thread Oleksandr Kryvulia

18.05.24 12:42, Tomek CEDRO:

does it also affect usb keyboard in single boot mode?


Good question. I don't have usb keyboerd right now and will check it a 
bit later.





Re: usb mouse not work on boot

2024-05-18 Thread Nuno Teixeira
Hello,

To fix my setup with usb mouse and audio dac on both amd64 (laptop) and
rpi4:

/boot/loader.conf.local:
snd_uaudio_load="YES"
ums_load="YES"

This restores previous behaviour as it detects mouse before login prompt
and audio dac that it is processed correctly by sysctl.

Cheers,

Oleksandr Kryvulia  escreveu (sábado, 18/05/2024
à(s) 09:24):

> 18.05.24 10:26, Gary Jennejohn:
> > On Sat, 18 May 2024 09:20:24 +0300
> > Oleksandr Kryvulia  wrote:
> >
> >> After 6437872c1d665c2605f54e8ff040b0ba41edad07 my usb mouse no longer
> >> works on boot because uhid(4) is not autoloaded. To make it work I need
> >> manualy load uhid or replug my usb mouse.
> >>
> > Try adding uhid_load="YES" to your /boot/loader.conf.  With that added
> > the module should be automatically loaded during the kernel boot.
>
> As workaround I already have kld_list+="uhid" in /etc/rc.conf. But IMHO
> it some regression.
>
>
>

-- 
Nuno Teixeira
FreeBSD UNIX: Web:  https://FreeBSD.org


Re: usb mouse not work on boot

2024-05-18 Thread Oleksandr Kryvulia

18.05.24 10:26, Gary Jennejohn:

On Sat, 18 May 2024 09:20:24 +0300
Oleksandr Kryvulia  wrote:


After 6437872c1d665c2605f54e8ff040b0ba41edad07 my usb mouse no longer
works on boot because uhid(4) is not autoloaded. To make it work I need
manualy load uhid or replug my usb mouse.


Try adding uhid_load="YES" to your /boot/loader.conf.  With that added
the module should be automatically loaded during the kernel boot.


As workaround I already have kld_list+="uhid" in /etc/rc.conf. But IMHO 
it some regression.





Re: usb mouse not work on boot

2024-05-18 Thread Gary Jennejohn
On Sat, 18 May 2024 09:20:24 +0300
Oleksandr Kryvulia  wrote:

> After 6437872c1d665c2605f54e8ff040b0ba41edad07 my usb mouse no longer
> works on boot because uhid(4) is not autoloaded. To make it work I need
> manualy load uhid or replug my usb mouse.
>

Try adding uhid_load="YES" to your /boot/loader.conf.  With that added
the module should be automatically loaded during the kernel boot.

--
Gary Jennejohn