re: CVS commit: src/usr.sbin/usbdevs

2019-09-22 Thread matthew green
> On further thought, I think your patch won't work correctly in cases
> where USB controllers are detached.  For example, if you attach usb0
> and usb1, and then detach usb0, getusbcount_device() will return 1,
> and usbdevs will try to list devices only on the detached usb0, and
> not on the still attached usb1.

good point.

i'll re-think...including your suggestion about notifying
the user about missing devices.

thanks!


.mrg.


re: CVS commit: src/usr.sbin/usbdevs

2019-09-22 Thread Andreas Gustafsson
Matthew,

On further thought, I think your patch won't work correctly in cases
where USB controllers are detached.  For example, if you attach usb0
and usb1, and then detach usb0, getusbcount_device() will return 1,
and usbdevs will try to list devices only on the detached usb0, and
not on the still attached usb1.
-- 
Andreas Gustafsson, g...@netbsd.org


re: CVS commit: src/usr.sbin/usbdevs

2019-09-22 Thread Andreas Gustafsson
Hi mrg

You wrote:
> > Look for up to 16 USB controllers, to match the number of device nodes
> > now created by MAKEDEV.
> 
> thanks for doing this.  you inspired me to get usbdevs to get the
> count from drvctl(8) if available, so next time we don't have to
> patch it again.  based upon the code in drvctl(8).
> 
> what do you think?
> 
>https://www.netbsd.org/~mrg/usbdevs.anycount.diff

Thanks for improving on my commit.  Your patch looks correct as far
as I can see, but rather complicated for what it does.  Couldn't we
get the same end result simply by looping until opening /dev/usbN
yields ENOENT?

Or alternatively, if we do spend the effort to walk the device tree,
we should use the information gained from that to full advantage by
issuing warnings about missing /dev/usbN device nodes rather than just
silently ignoring the affected controllers.
-- 
Andreas Gustafsson, g...@netbsd.org


re: CVS commit: src/usr.sbin/usbdevs

2019-09-21 Thread matthew green
"Andreas Gustafsson" writes:
> Module Name:  src
> Committed By: gson
> Date: Sat Sep 21 16:22:25 UTC 2019
> 
> Modified Files:
>   src/usr.sbin/usbdevs: usbdevs.c
> 
> Log Message:
> Look for up to 16 USB controllers, to match the number of device nodes
> now created by MAKEDEV.

thanks for doing this.  you inspired me to get usbdevs to get the
count from drvctl(8) if available, so next time we don't have to
patch it again.  based upon the code in drvctl(8).

what do you think?

   https://www.netbsd.org/~mrg/usbdevs.anycount.diff

thanks.


.mrg.