On Fri, Sep 22, 2017, at 05:18, Bryan Linton wrote:
> On 2017-09-22 12:38:32, Martin Pieuchot <m...@openbsd.org> wrote:
> > On 20/09/17(Wed) 09:13, Anthony J. Bentley wrote:
> > > Martin Pieuchot writes:
> > > > Do you know if the games are multi-threaded?  Could you run "top -H" and
> > > > "kdump -H"?
> > > 
> > > top -H shows a single line for gambatte.
> > 
> > Thanks.  Could you try the diff below?  It includes some debug stuff and
> > a potential fix.
> > 
> 
> I can confirm that this patch fixes dgen, mgba, and desmume for
> me!  I assume that other SDL programs would be fixed as well.  I
> encourage others to share their results.
> 
> FWIW, my dmesg is filled with things like the following (only the
> last few lines pasted in):
> 
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidread
>    1 uhidread: got 7 chars
>    1 uhidclose: sc=0xffff8000005cd000
> 
> > I'm guessing that the problem is that my last change made uhid_do_ioctl()
> > return an error for FIOASYNC.  This makes the following syscall fall:
> > 
> > 390:        /* The poll blocks the event thread. */
> > 391:        fcntl(fd, F_SETFL, O_NONBLOCK)
> > 
> > 
> > As a result FNONBLOCK is not set on the 'struct file' and uhid_do_read()
> > block, or "freeze", when there's nothing to read instead of returning
> > EWOULDBLOCK.
> > 
> > 
> 
> Hmm, it's interesting to know how the solution was arrived at :)
> 
> Thank you very much for taking the time to look into this!
> 
> -- 
> Bryan
> 

The patch also allows fixes controllers in mednafen, for what it's
worth. Thanks, all, for investigating!

Reply via email to