#ifdef DARWIN
+#include <unistd.h>
+
#undef USE_POLL
/* Mac OS X don't have strndup even if _GNU_SOURCE is defined */
got_string = CFStringGetCString(entry_as_string,
result, result_len,
kCFStringEncodingASCII);
-
+
CFRelease(entry_as_string);
if (got_string)
return 1;
{
CFTypeRef entry_as_number;
Boolean got_number;
-
+
entry_as_number = IORegistryEntrySearchCFProperty (object,
kIOServicePlane,
entry,
object = IOIteratorNext(list->iterator);
if (!object)
return 0;
-
+
if (!get_number (object, CFSTR(kUSBVendorID), &device->vendor) ||
!get_number (object, CFSTR(kUSBProductID), &device->product))
continue;
- if (list->ftdi) {
- if (device->vendor != 0x0403)
- continue;
- } else {
- if (device->vendor != 0xfffe)
- continue;
- if (device->product < 0x000a || 0x0013 < device->product)
- continue;
- }
if (get_string (object, CFSTR("IOCalloutDevice"), device->path, sizeof (device->path)) &&
get_string (object, CFSTR("USB Product Name"), device->name, sizeof (device->name)) &&
get_string (object, CFSTR("USB Serial Number"), serial_string, sizeof (serial_string))) {
if (log) {
SYSTEMTIME time;
GetLocalTime(&time);
- fprintf (log, "%4d-%02d-%02d %2d:%02d:%02d. ",
+ fprintf (log, "%4d-%02d-%02d %2d:%02d:%02d. ",
time.wYear, time.wMonth, time.wDay,
time.wHour, time.wMinute, time.wSecond);
va_start(a, fmt);
altos_set_last_windows_error();
Sleep(100);
}
-
+
if (file->handle == INVALID_HANDLE_VALUE) {
free(file);
return NULL;