cmake: fix uses of undefined macro identifiers (-Wundef)
This commit is contained in:
1 parent
cc7c0a2dab
commit
d81d986858
430 files changed
+1289
-1260
No files matched your search
+33
-31
@@ -35,7 +35,7 @@
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
@@ -556,9 +556,9 @@ static void HIDAPI_ShutdownDiscovery()
|
||||
#define read_thread PLATFORM_read_thread
|
||||
|
||||
#undef HIDAPI_H__
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
|
||||
#define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value
|
||||
@@ -578,23 +578,23 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
#define udev_enumerate_unref udev_ctx->udev_enumerate_unref
|
||||
|
||||
#include "linux/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define HAVE_PLATFORM_BACKEND
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
||||
#elif __MACOSX__
|
||||
#elif defined(__MACOSX__)
|
||||
#include "mac/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define HAVE_PLATFORM_BACKEND
|
||||
#define udev_ctx 1
|
||||
#elif __WINDOWS__ || __WINGDK__
|
||||
#elif defined(__WINDOWS__) || defined(__WINGDK__)
|
||||
#include "windows/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define HAVE_PLATFORM_BACKEND
|
||||
#define udev_ctx 1
|
||||
#elif __ANDROID__
|
||||
#elif defined(__ANDROID__)
|
||||
/* The implementation for Android is in a separate .cpp file */
|
||||
#include "hidapi/hidapi.h"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define udev_ctx 1
|
||||
#elif __IPHONEOS__ || __TVOS__
|
||||
#elif defined(__IPHONEOS__) || defined(__TVOS__)
|
||||
/* The implementation for iOS and tvOS is in a separate .m file */
|
||||
#include "hidapi/hidapi.h"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
@@ -630,9 +630,11 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
|
||||
#define HAVE_DRIVER_BACKEND 1
|
||||
#else
|
||||
#define HAVE_DRIVER_BACKEND 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
|
||||
/* DRIVER HIDAPI Implementation */
|
||||
|
||||
@@ -897,7 +899,7 @@ struct hidapi_backend
|
||||
const wchar_t *(*hid_error)(void *device);
|
||||
};
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
static const struct hidapi_backend PLATFORM_Backend = {
|
||||
(void *)PLATFORM_hid_write,
|
||||
(void *)PLATFORM_hid_read_timeout,
|
||||
@@ -956,7 +958,7 @@ struct SDL_hid_device_
|
||||
};
|
||||
static char device_magic;
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
|
||||
static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
|
||||
{
|
||||
@@ -981,8 +983,8 @@ static void DeleteHIDDeviceWrapper(SDL_hid_device *device)
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
|
||||
#define COPY_IF_EXISTS(var) \
|
||||
if (pSrc->var != NULL) { \
|
||||
@@ -1129,9 +1131,9 @@ int SDL_hid_init(void)
|
||||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
++attempts;
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
udev_ctx = SDL_UDEV_GetUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
if (udev_ctx && PLATFORM_hid_init() == 0) {
|
||||
@@ -1160,15 +1162,15 @@ int SDL_hid_exit(void)
|
||||
}
|
||||
SDL_hidapi_refcount = 0;
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
HIDAPI_ShutdownDiscovery();
|
||||
#endif
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
result |= PLATFORM_hid_exit();
|
||||
}
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
SDL_UDEV_ReleaseUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
@@ -1190,7 +1192,7 @@ Uint32 SDL_hid_device_change_count(void)
|
||||
{
|
||||
Uint32 counter = 0;
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1210,7 +1212,7 @@ Uint32 SDL_hid_device_change_count(void)
|
||||
|
||||
struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#ifdef HAVE_LIBUSB
|
||||
struct SDL_hid_device_info *usb_devs = NULL;
|
||||
struct SDL_hid_device_info *usb_dev;
|
||||
@@ -1219,7 +1221,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
||||
struct SDL_hid_device_info *driver_devs = NULL;
|
||||
struct SDL_hid_device_info *driver_dev;
|
||||
#endif
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
struct SDL_hid_device_info *raw_devs = NULL;
|
||||
struct SDL_hid_device_info *raw_dev;
|
||||
#endif
|
||||
@@ -1260,7 +1262,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
||||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
driver_devs = DRIVER_hid_enumerate(vendor_id, product_id);
|
||||
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
|
||||
new_dev = (struct SDL_hid_device_info *)SDL_malloc(sizeof(struct SDL_hid_device_info));
|
||||
@@ -1275,7 +1277,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
||||
}
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
|
||||
#ifdef DEBUG_HIDAPI
|
||||
@@ -1298,7 +1300,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
|
||||
if (raw_dev->vendor_id == driver_dev->vendor_id &&
|
||||
raw_dev->product_id == driver_dev->product_id &&
|
||||
@@ -1363,14 +1365,14 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs)
|
||||
|
||||
SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
|
||||
if (pDevice != NULL) {
|
||||
@@ -1402,14 +1404,14 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
|
||||
|
||||
SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
pDevice = PLATFORM_hid_open_path(path, bExclusive);
|
||||
if (pDevice != NULL) {
|
||||
@@ -1579,7 +1581,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t
|
||||
|
||||
void SDL_hid_ble_scan(SDL_bool active)
|
||||
{
|
||||
#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__)
|
||||
#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IPHONEOS__) || defined(__TVOS__))
|
||||
hid_ble_scan(active);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function)
|
||||
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "../../core/android/SDL_android.h"
|
||||
@@ -744,7 +744,7 @@ public:
|
||||
env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId );
|
||||
ExceptionCheck( env, "Close" );
|
||||
}
|
||||
|
||||
|
||||
hid_mutex_guard dataLock( &m_dataLock );
|
||||
m_vecData.clear();
|
||||
|
||||
@@ -1139,7 +1139,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx
|
||||
hid_mutex_guard l( &g_DevicesMutex );
|
||||
for ( hid_device_ref<CHIDDevice> pCurr = g_Devices; pCurr; pCurr = pCurr->next )
|
||||
{
|
||||
if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 )
|
||||
if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 )
|
||||
{
|
||||
hid_device *pValue = pCurr->GetDevice();
|
||||
if ( pValue )
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace NAMESPACE {
|
||||
*/
|
||||
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev);
|
||||
|
||||
#if __IPHONEOS__ || __TVOS__
|
||||
#if defined(__IPHONEOS__) || defined(__TVOS__)
|
||||
HID_API_EXPORT void HID_API_CALL hid_ble_scan(int active);
|
||||
#endif
|
||||
|
||||
|
||||
+31
-31
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#include "SDL_hints.h"
|
||||
|
||||
@@ -131,7 +131,7 @@ static void RingBuffer_init( RingBuffer *this )
|
||||
this->_last = 0;
|
||||
pthread_mutex_init( &this->accessLock, 0 );
|
||||
}
|
||||
|
||||
|
||||
static bool RingBuffer_write( RingBuffer *this, const uint8_t *src )
|
||||
{
|
||||
pthread_mutex_lock( &this->accessLock );
|
||||
@@ -290,7 +290,7 @@ typedef enum
|
||||
{
|
||||
static uint64_t s_unLastUpdateTick = 0;
|
||||
static mach_timebase_info_data_t s_timebase_info;
|
||||
|
||||
|
||||
if ( self.centralManager == nil )
|
||||
{
|
||||
return 0;
|
||||
@@ -300,11 +300,11 @@ typedef enum
|
||||
{
|
||||
mach_timebase_info( &s_timebase_info );
|
||||
}
|
||||
|
||||
|
||||
uint64_t ticksNow = mach_approximate_time();
|
||||
if ( !bForce && ( ( (ticksNow - s_unLastUpdateTick) * s_timebase_info.numer ) / s_timebase_info.denom ) < (5ull * NSEC_PER_SEC) )
|
||||
return (int)self.deviceMap.count;
|
||||
|
||||
|
||||
// we can see previously connected BLE peripherals but can't connect until the CBCentralManager
|
||||
// is fully powered up - only do work when we are in that state
|
||||
if ( self.centralManager.state != CBManagerStatePoweredOn )
|
||||
@@ -312,7 +312,7 @@ typedef enum
|
||||
|
||||
// only update our last-check-time if we actually did work, otherwise there can be a long delay during initial power-up
|
||||
s_unLastUpdateTick = mach_approximate_time();
|
||||
|
||||
|
||||
// if a pair is in-flight, the central manager may still give it back via retrieveConnected... and
|
||||
// cause the SDL layer to attempt to initialize it while some of its endpoints haven't yet been established
|
||||
if ( self.nPendingPairs > 0 )
|
||||
@@ -324,7 +324,7 @@ typedef enum
|
||||
// we already know this peripheral
|
||||
if ( [self.deviceMap objectForKey: peripheral] != nil )
|
||||
continue;
|
||||
|
||||
|
||||
NSLog( @"connected peripheral: %@", peripheral );
|
||||
if ( [peripheral.name isEqualToString:@"SteamController"] )
|
||||
{
|
||||
@@ -392,7 +392,7 @@ typedef enum
|
||||
case CBCentralManagerStatePoweredOn:
|
||||
{
|
||||
NSLog( @"CoreBluetooth BLE hardware is powered on and ready" );
|
||||
|
||||
|
||||
// at startup, if we have no already attached peripherals, do a 20s scan for new unpaired devices,
|
||||
// otherwise callers should occaisionally do additional scans. we don't want to continuously be
|
||||
// scanning because it drains battery, causes other nearby people to have a hard time pairing their
|
||||
@@ -408,23 +408,23 @@ typedef enum
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case CBCentralManagerStatePoweredOff:
|
||||
NSLog( @"CoreBluetooth BLE hardware is powered off" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnauthorized:
|
||||
NSLog( @"CoreBluetooth BLE state is unauthorized" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnknown:
|
||||
NSLog( @"CoreBluetooth BLE state is unknown" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnsupported:
|
||||
NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateResetting:
|
||||
NSLog( @"CoreBluetooth BLE manager is resetting" );
|
||||
break;
|
||||
@@ -449,7 +449,7 @@ typedef enum
|
||||
{
|
||||
NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey];
|
||||
NSString *log = [NSString stringWithFormat:@"Found '%@'", localName];
|
||||
|
||||
|
||||
if ( [localName isEqualToString:@"SteamController"] )
|
||||
{
|
||||
NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData );
|
||||
@@ -552,7 +552,7 @@ static void process_pending_events()
|
||||
{
|
||||
#if FEATURE_REPORT_LOGGING
|
||||
uint8_t *reportBytes = (uint8_t *)report;
|
||||
|
||||
|
||||
NSLog( @"HIDBLE:send_feature_report (%02zu/19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", GetBluetoothSegmentSize( report->segment ),
|
||||
reportBytes[1], reportBytes[2], reportBytes[3], reportBytes[4], reportBytes[5], reportBytes[6],
|
||||
reportBytes[7], reportBytes[8], reportBytes[9], reportBytes[10], reportBytes[11], reportBytes[12],
|
||||
@@ -568,7 +568,7 @@ static void process_pending_events()
|
||||
// fire-and-forget - we are going to not wait for the response here because all Steam Controller BLE send_feature_report's are ignored,
|
||||
// except errors.
|
||||
[_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse];
|
||||
|
||||
|
||||
// pretend we received a result anybody cares about
|
||||
return 19;
|
||||
|
||||
@@ -578,18 +578,18 @@ static void process_pending_events()
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_Waiting;
|
||||
[_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize
|
||||
] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse];
|
||||
|
||||
|
||||
while ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Waiting )
|
||||
{
|
||||
process_pending_events();
|
||||
}
|
||||
|
||||
|
||||
if ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Error )
|
||||
{
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_None;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_None;
|
||||
return 19;
|
||||
#endif
|
||||
@@ -599,20 +599,20 @@ static void process_pending_events()
|
||||
{
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_Waiting;
|
||||
[_bleSteamController readValueForCharacteristic:_bleCharacteristicReport];
|
||||
|
||||
|
||||
while ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Waiting )
|
||||
process_pending_events();
|
||||
|
||||
|
||||
if ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Error )
|
||||
{
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_None;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
memcpy( buffer, _featureReport, sizeof(_featureReport) );
|
||||
|
||||
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_None;
|
||||
|
||||
|
||||
#if FEATURE_REPORT_LOGGING
|
||||
NSLog( @"HIDBLE:get_feature_report (19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]",
|
||||
buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6],
|
||||
@@ -657,7 +657,7 @@ static void process_pending_events()
|
||||
for (CBCharacteristic *aChar in service.characteristics)
|
||||
{
|
||||
NSLog( @"Found Characteristic %@", aChar );
|
||||
|
||||
|
||||
if ( [aChar.UUID isEqual:[CBUUID UUIDWithString:VALVE_INPUT_CHAR]] )
|
||||
{
|
||||
self.bleCharacteristicInput = aChar;
|
||||
@@ -704,7 +704,7 @@ static void process_pending_events()
|
||||
else if ( [characteristic.UUID isEqual:_bleCharacteristicReport.UUID] )
|
||||
{
|
||||
memset( _featureReport, 0, sizeof(_featureReport) );
|
||||
|
||||
|
||||
if ( error != nil )
|
||||
{
|
||||
NSLog( @"HIDBLE: get_feature_report error: %@", error );
|
||||
@@ -789,13 +789,13 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path( const char *path, int bE
|
||||
NSString *nssPath = [NSString stringWithUTF8String:path];
|
||||
HIDBLEManager *bleManager = HIDBLEManager.sharedInstance;
|
||||
NSEnumerator<HIDBLEDevice *> *devices = [bleManager.deviceMap objectEnumerator];
|
||||
|
||||
|
||||
for ( HIDBLEDevice *device in devices )
|
||||
{
|
||||
// we have the device but it hasn't found its service or characteristics until it is connected
|
||||
if ( !device.ready || !device.connected || !device.bleCharacteristicInput )
|
||||
continue;
|
||||
|
||||
|
||||
if ( [device.bleSteamController.identifier.UUIDString isEqualToString:nssPath] )
|
||||
{
|
||||
result = (hid_device *)malloc( sizeof( hid_device ) );
|
||||
@@ -829,7 +829,7 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
|
||||
{
|
||||
/* All Nonblocking operation is handled by the library. */
|
||||
dev->blocking = !nonblock;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -953,7 +953,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
|
||||
return -1;
|
||||
|
||||
size_t written = [device_handle get_feature_report:data[0] into:data];
|
||||
|
||||
|
||||
return written == length-1 ? (int)length : (int)written;
|
||||
}
|
||||
|
||||
@@ -973,7 +973,7 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
|
||||
|
||||
if ( !device_handle.connected )
|
||||
return -1;
|
||||
|
||||
|
||||
if ( milliseconds != 0 )
|
||||
{
|
||||
NSLog( @"hid_read_timeout with non-zero wait" );
|
||||
|
||||
Reference in new issue
Block a user