FTDI user space on Windows

Dirk Hohndel dirk at hohndel.org
Sun Sep 9 22:05:01 PDT 2018


This should be so simple. libtfdi is available in MXE, so just build against it, right?
Except this:

static dc_status_t serial_ftdi_sleep (void *io, unsigned int timeout)
{
        ftdi_serial_t *device = io;

        if (device == NULL)
                return DC_STATUS_INVALIDARGS;

        INFO (device->context, "Sleep: value=%u", timeout);

        struct timespec ts;
        ts.tv_sec  = (timeout / 1000);
        ts.tv_nsec = (timeout % 1000) * 1000000;

        while (nanosleep (&ts, &ts) != 0) {
                if (errno != EINTR ) {
                        SYSERROR (device->context, errno);
                        return DC_STATUS_IO;
                }
        }

        return DC_STATUS_SUCCESS;
}

Turns out Windows doesn't have nanosleep. And I can't seem to find a function with comparable semantic, unless I use the one in the pthread library that is provided by MinGW which is not what we want to do.
So the question becomes how to represent this with something that gives us the same semantic / functionality.

I am anything but a Windows expert. Suggestions welcome.

Thanks

/D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20180909/e4df2cdc/attachment.html>


More information about the subsurface mailing list