shithub: riscv

Download patch

ref: 5ab9f9c621a04ed4544cd32b2fff3d020ec542c2
parent: 1427ba31264b4f06ec7971612e5b406c5b57efd6
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jun 3 03:21:48 EDT 2014

nusb/usbd: serialize /dev/usbevent processing

when there are multiple readers of /dev/usbevent, we have to
serialize the processing to make sure that only one driver
is opening the devices control endpoint at a time.

to do this, we assume the device is busy after reading the
event file until the next read or clunk on the same fid.

to mark a device busy, we set the dev->aux pointer to the
fid processing a event. And the Event structure takes a
reference to the device producing the event.

the problem arised from cdc ethernet and nusb/serial sharing
the same device class, and we need to run the particular driver
to figure out if the device can be used. doing this concurrently
fails because devusb allows only one open per endpoint.