USB stack getting confused

O'Connor, Daniel darius at dons.net.au
Mon Mar 11 04:01:09 UTC 2019



> On 10 Mar 2019, at 23:40, Hans Petter Selasky <hps at selasky.org> wrote:
> On 3/10/19 11:26 AM, Konstantin Belousov wrote:
>> On Sun, Mar 10, 2019 at 11:18:36AM +0100, Hans Petter Selasky wrote:
>>> On 3/10/19 10:47 AM, Konstantin Belousov wrote:
>>>>> Yes, I can do that if destroy_dev() ensures that d_close is called for
>>>>> all open file handles once and only once before it returns. I think this
>>>>> is where the problem comes from.
>>>> See above.  For d_close it is impossible, for cdevpriv dtr it is already
>>>> there by design.
>>>> 
>>> 
>>> Yes, cdevpriv_dtr will wait for the final close() from user-space
>>> unfortunately. Or am I mistaken?
>> You are mistaken.  Cdevpriv destructors are called either on the file close
>> (not the last close in d_close sense, just file close) OR during destroy_dev().
>> Each destructor/file pair is called exactly once, regardless of the cause.
> 
> Can you try the attached patch?

I tried it but it didn't help the problem.
I put a break point at ugen20_enumerate at libusb20_ugen20.c:149 I can see it try and open /dev/ugenX.Y but 0.5 (my device) fails with errno set to 12 (ENOMEM).

I can dig into the kernel part if you want but will need some guidance where to look..

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum




More information about the freebsd-hackers mailing list