mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-04 01:34:38 +00:00 
			
		
		
		
	Re-enumerate devices if a read fails
This allows combined Joy-Con devices to immediately separate if one of them is disconnected
This commit is contained in:
		@@ -1003,7 +1003,10 @@ HIDAPI_UpdateDevices(void)
 | 
				
			|||||||
            if (device->driver) {
 | 
					            if (device->driver) {
 | 
				
			||||||
                if (SDL_TryLockMutex(device->dev_lock) == 0) {
 | 
					                if (SDL_TryLockMutex(device->dev_lock) == 0) {
 | 
				
			||||||
                    device->updating = SDL_TRUE;
 | 
					                    device->updating = SDL_TRUE;
 | 
				
			||||||
                    device->driver->UpdateDevice(device);
 | 
					                    if (!device->driver->UpdateDevice(device)) {
 | 
				
			||||||
 | 
					                        /* Try re-enumerating the device if it fails */
 | 
				
			||||||
 | 
					                        SDL_HIDAPI_change_count = 0;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    device->updating = SDL_FALSE;
 | 
					                    device->updating = SDL_FALSE;
 | 
				
			||||||
                    SDL_UnlockMutex(device->dev_lock);
 | 
					                    SDL_UnlockMutex(device->dev_lock);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user