瀏覽代碼

Improved Steam Controller detection on iOS

Sam Lantinga 8 月之前
父節點
當前提交
748f0b3201
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/hidapi/ios/hid.m

+ 2 - 2
src/hidapi/ios/hid.m

@@ -335,7 +335,7 @@ typedef enum
 			continue;
 			continue;
 
 
 		NSLog( @"connected peripheral: %@", peripheral );
 		NSLog( @"connected peripheral: %@", peripheral );
-		if ( [peripheral.name isEqualToString:@"SteamController"] )
+		if ( [peripheral.name hasPrefix:@"Steam"] )
 		{
 		{
 			self.nPendingPairs += 1;
 			self.nPendingPairs += 1;
 			HIDBLEDevice *steamController = [[HIDBLEDevice alloc] initWithPeripheral:peripheral];
 			HIDBLEDevice *steamController = [[HIDBLEDevice alloc] initWithPeripheral:peripheral];
@@ -459,7 +459,7 @@ typedef enum
 	NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey];
 	NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey];
 	NSString *log = [NSString stringWithFormat:@"Found '%@'", localName];
 	NSString *log = [NSString stringWithFormat:@"Found '%@'", localName];
 
 
-	if ( [localName isEqualToString:@"SteamController"] )
+	if ( [localName hasPrefix:@"Steam"] )
 	{
 	{
 		NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData );
 		NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData );
 		self.nPendingPairs += 1;
 		self.nPendingPairs += 1;