On 17/04/15(Fri) 16:47, Dimitris Papastamos wrote:
> Hi,
> 
> This patch adds an option to usbdevs(8) to disable USB bus probing
> at runtime.  The operation is restricted to the root user.

It would be nice to show if probing is on or off, for example

# usbdevs -p
bus probing: on

# usbdevs -p off

But other people might have better suggestions.

> I am not sure if this approach is sensible or even correct.  Some
> pointers would be much appreciated.

Setting a variable per hub (and here roothub) is overkill, a global
would be enough.

> 
> This was started as part of a reply by mpi on tech@
> 
>   http://marc.info/?l=openbsd-tech&m=142917883126679&w=2
> 
> I guess the reasoning behind this is to add some protection against
> things like badusb?

It can have multiple usages :)

How did you try it?  What happen if you plug a hub with multiple
devices, turn bus probing off then detach the hub?

What happen if you plug a device like a phone that use the power to
charge its battery after turning probing off.  If I read your diff
correctly you still allow the device to be charged which is fine.  Did
you try that?  I think it's worth a documentation note.

>       if (!dev->self_powered && dev->powersrc->parent != NULL &&
>           !dev->powersrc->parent->self_powered) {
> @@ -494,6 +495,9 @@ uhub_explore(struct usbd_device *dev)
>                */
>               if (speed > sc->sc_hub->speed)
>                       speed = sc->sc_hub->speed;
> +
> +             if (dev->hub->noprobe)
> +                     return (0);

I believe you can move that before the "Figure out device speed". 

Reply via email to