Jelajahi Sumber

add logging for the case when haptic is not detected on the joystick as well.

Edward Rudd 11 tahun lalu
induk
melakukan
8512f1b87c
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      test/testhotplug.c

+ 6 - 1
test/testhotplug.c

@@ -78,9 +78,13 @@ main(int argc, char *argv[])
                                     haptic = NULL;
                                 }
                             } else {
-                                SDL_Log("Joy haptic FAILED!\n");
+                                SDL_Log("Joy haptic open FAILED!\n");
                             }
                         }
+                        else
+                        {
+                            SDL_Log("No haptic found\n");
+                        }
                     }
                     break;
                 case SDL_JOYDEVICEREMOVED:
@@ -91,6 +95,7 @@ main(int argc, char *argv[])
                         if(haptic)
                         {
                             SDL_HapticClose(haptic);
+                            haptic = NULL;
                         }
                         SDL_JoystickClose(joystick);
                         joystick = NULL;