Prefixed all haptic errors with "Haptic:" for easier readability. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Thu, 10 Jul 2008 11:39:28 +0000
branchgsoc2008_force_feedback
changeset 251355fd9103a330
parent 2512 ef147ee4896c
child 2514 840e1b6325c0
Prefixed all haptic errors with "Haptic:" for easier readability.
src/haptic/SDL_haptic.c
src/haptic/linux/SDL_syshaptic.c
     1.1 --- a/src/haptic/SDL_haptic.c	Thu Jul 10 08:38:08 2008 +0000
     1.2 +++ b/src/haptic/SDL_haptic.c	Thu Jul 10 11:39:28 2008 +0000
     1.3 @@ -67,7 +67,7 @@
     1.4     int valid;
     1.5     
     1.6     if (*haptic == NULL) {
     1.7 -      SDL_SetError("Haptic device hasn't been opened yet");
     1.8 +      SDL_SetError("Haptic: Device hasn't been opened yet");
     1.9        valid = 0;
    1.10     } else {
    1.11        valid = 1;
    1.12 @@ -93,7 +93,7 @@
    1.13  SDL_HapticName(int device_index)
    1.14  {
    1.15     if ((device_index < 0) || (device_index >= SDL_numhaptics)) {
    1.16 -      SDL_SetError("There are %d haptic devices available", SDL_numhaptics);
    1.17 +      SDL_SetError("Haptic: There are %d haptic devices available", SDL_numhaptics);
    1.18        return NULL;
    1.19     }
    1.20     return SDL_SYS_HapticName(device_index);
    1.21 @@ -110,7 +110,7 @@
    1.22     SDL_Haptic *haptic;
    1.23  
    1.24     if ((device_index < 0) || (device_index >= SDL_numhaptics)) {
    1.25 -      SDL_SetError("There are %d haptic devices available", SDL_numhaptics);
    1.26 +      SDL_SetError("Haptic: There are %d haptic devices available", SDL_numhaptics);
    1.27        return NULL;
    1.28     }
    1.29  
    1.30 @@ -210,7 +210,7 @@
    1.31     device_index = SDL_SYS_HapticMouse();
    1.32  
    1.33     if (device_index < 0) {
    1.34 -      SDL_SetError("Mouse isn't a haptic device.");
    1.35 +      SDL_SetError("Haptic: Mouse isn't a haptic device.");
    1.36        return NULL;
    1.37     }
    1.38  
    1.39 @@ -401,7 +401,7 @@
    1.40  
    1.41     /* Check to see if effect is supported */
    1.42     if (SDL_HapticEffectSupported(haptic,effect)==SDL_FALSE) {
    1.43 -      SDL_SetError("Haptic effect not supported by haptic device.");
    1.44 +      SDL_SetError("Haptic: Effect not supported by haptic device.");
    1.45        return -1;
    1.46     }
    1.47  
    1.48 @@ -417,7 +417,7 @@
    1.49        }
    1.50     }
    1.51  
    1.52 -   SDL_SetError("Haptic device has no free space left.");
    1.53 +   SDL_SetError("Haptic: Device has no free space left.");
    1.54     return -1;
    1.55  }
    1.56  
    1.57 @@ -428,7 +428,7 @@
    1.58  ValidEffect(SDL_Haptic * haptic, int effect)
    1.59  {
    1.60     if ((effect < 0) || (effect >= haptic->neffects)) {
    1.61 -      SDL_SetError("Invalid haptic effect identifier.");
    1.62 +      SDL_SetError("Haptic: Invalid effect identifier.");
    1.63        return 0;
    1.64     }
    1.65     return 1;
    1.66 @@ -518,7 +518,7 @@
    1.67     }
    1.68  
    1.69     if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) {
    1.70 -      SDL_SetError("Haptic device does not support status queries.");
    1.71 +      SDL_SetError("Haptic: Device does not support status queries.");
    1.72        return -1;
    1.73     }
    1.74  
    1.75 @@ -539,12 +539,12 @@
    1.76     }
    1.77  
    1.78     if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) {
    1.79 -      SDL_SetError("Haptic device does not support setting gain.");
    1.80 +      SDL_SetError("Haptic: Device does not support setting gain.");
    1.81        return -1;
    1.82     }
    1.83  
    1.84     if ((gain < 0) || (gain > 100)) {
    1.85 -      SDL_SetError("Haptic gain must be between 0 and 100.");
    1.86 +      SDL_SetError("Haptic: Gain must be between 0 and 100.");
    1.87        return -1;
    1.88     }
    1.89  
    1.90 @@ -582,12 +582,12 @@
    1.91     }
    1.92  
    1.93     if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) {
    1.94 -      SDL_SetError("Haptic device does not support setting autocenter.");
    1.95 +      SDL_SetError("Haptic: Device does not support setting autocenter.");
    1.96        return -1;
    1.97     }
    1.98  
    1.99     if ((autocenter < 0) || (autocenter > 100)) {
   1.100 -      SDL_SetError("Haptic autocenter must be between 0 and 100.");
   1.101 +      SDL_SetError("Haptic: Autocenter must be between 0 and 100.");
   1.102        return -1;
   1.103     }                                           
   1.104  
     2.1 --- a/src/haptic/linux/SDL_syshaptic.c	Thu Jul 10 08:38:08 2008 +0000
     2.2 +++ b/src/haptic/linux/SDL_syshaptic.c	Thu Jul 10 11:39:28 2008 +0000
     2.3 @@ -94,7 +94,7 @@
     2.4     /* Ask device for what it has. */
     2.5     ret = 0;
     2.6     if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(features)), features) < 0) {
     2.7 -      SDL_SetError("Unable to get device's haptic abilities: %s", strerror(errno));
     2.8 +      SDL_SetError("Haptic: Unable to get device's features: %s", strerror(errno));
     2.9        return -1;
    2.10     }
    2.11  
    2.12 @@ -257,7 +257,7 @@
    2.13  
    2.14     /* Set the effects */
    2.15     if (ioctl(fd, EVIOCGEFFECTS, &haptic->neffects) < 0) {
    2.16 -      SDL_SetError("Unable to query haptic device memory: %s", strerror(errno));
    2.17 +      SDL_SetError("Haptic: Unable to query device memory: %s", strerror(errno));
    2.18        goto open_err;
    2.19     }
    2.20     haptic->effects = (struct haptic_effect *)
    2.21 @@ -294,7 +294,7 @@
    2.22     /* Open the character device */
    2.23     fd = open(SDL_hapticlist[haptic->index].fname, O_RDWR, 0);
    2.24     if (fd < 0) {
    2.25 -      SDL_SetError("Unable to open %s: %s",
    2.26 +      SDL_SetError("Haptic: Unable to open %s: %s",
    2.27              SDL_hapticlist[haptic->index], strerror(errno));
    2.28        return -1;
    2.29     }
    2.30 @@ -317,7 +317,7 @@
    2.31        /* Open the device. */
    2.32        fd = open(SDL_hapticlist[i].fname, O_RDWR, 0);
    2.33        if (fd < 0) {
    2.34 -         SDL_SetError("Unable to open %s: %s",
    2.35 +         SDL_SetError("Haptic: Unable to open %s: %s",
    2.36                 SDL_hapticlist[i], strerror(errno));
    2.37           return -1;
    2.38        }
    2.39 @@ -590,7 +590,7 @@
    2.40  
    2.41  
    2.42        default:
    2.43 -         SDL_SetError("Unknown haptic effect type");
    2.44 +         SDL_SetError("Haptic: Unknown effect type.");
    2.45           return -1;
    2.46     }
    2.47  
    2.48 @@ -624,7 +624,7 @@
    2.49  
    2.50     /* Upload the effect */
    2.51     if (ioctl(haptic->hwdata->fd, EVIOCSFF, linux_effect) < 0) {
    2.52 -      SDL_SetError("Error uploading effect to the haptic device: %s", strerror(errno));
    2.53 +      SDL_SetError("Haptic: Error uploading effect to the device: %s", strerror(errno));
    2.54        goto new_effect_err;
    2.55     }
    2.56  
    2.57 @@ -656,7 +656,7 @@
    2.58  
    2.59     /* See if it can be uploaded. */
    2.60     if (ioctl(haptic->hwdata->fd, EVIOCSFF, &linux_effect) < 0) {
    2.61 -      SDL_SetError("Error updating the haptic effect: %s", strerror(errno));
    2.62 +      SDL_SetError("Haptic: Error updating the effect: %s", strerror(errno));
    2.63        return -1;
    2.64     }
    2.65  
    2.66 @@ -681,7 +681,7 @@
    2.67     run.value = 1;
    2.68  
    2.69     if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) {
    2.70 -      SDL_SetError("Unable to run the haptic effect: %s", strerror(errno));
    2.71 +      SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));
    2.72        return -1;
    2.73     }
    2.74  
    2.75 @@ -702,7 +702,7 @@
    2.76     stop.value = 0;
    2.77  
    2.78     if (write(haptic->hwdata->fd, (const void*) &stop, sizeof(stop)) < 0) {
    2.79 -      SDL_SetError("Unable to stop the haptic effect: %s", strerror(errno));
    2.80 +      SDL_SetError("Haptic: Unable to stop the effect: %s", strerror(errno));
    2.81        return -1;
    2.82     }
    2.83  
    2.84 @@ -717,7 +717,7 @@
    2.85  SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect * effect)
    2.86  {
    2.87     if (ioctl(haptic->hwdata->fd, EVIOCRMFF, effect->hweffect->effect.id) < 0) {
    2.88 -      SDL_SetError("Error removing the effect from the haptic device: %s",
    2.89 +      SDL_SetError("Haptic: Error removing the effect from the device: %s",
    2.90              strerror(errno));
    2.91     }
    2.92     SDL_free(effect->hweffect);
    2.93 @@ -739,7 +739,7 @@
    2.94     ie.code = effect->hweffect->effect.id;
    2.95  
    2.96     if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
    2.97 -      SDL_SetError("Error getting haptic device status.");
    2.98 +      SDL_SetError("Haptic: Error getting device status.");
    2.99        return -1;
   2.100     }
   2.101  
   2.102 @@ -763,7 +763,7 @@
   2.103     ie.value = (0xFFFFUL * gain) / 100;
   2.104  
   2.105     if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
   2.106 -      SDL_SetError("Error setting gain: %s", strerror(errno));
   2.107 +      SDL_SetError("Haptic: Error setting gain: %s", strerror(errno));
   2.108        return -1;
   2.109     }
   2.110  
   2.111 @@ -784,7 +784,7 @@
   2.112     ie.value = (0xFFFFUL * autocenter) / 100;
   2.113  
   2.114     if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
   2.115 -      SDL_SetError("Error setting autocenter: %s", strerror(errno));
   2.116 +      SDL_SetError("Haptic: Error setting autocenter: %s", strerror(errno));
   2.117        return -1;
   2.118     }
   2.119