Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Prefixed all haptic errors with "Haptic:" for easier readability.

  • Loading branch information
bobbens committed Jul 10, 2008
1 parent e6ffae5 commit ff6281b73c9b151374c4240b6f803ef79bc151fd
Showing with 25 additions and 25 deletions.
  1. +12 −12 src/haptic/SDL_haptic.c
  2. +13 −13 src/haptic/linux/SDL_syshaptic.c
@@ -67,7 +67,7 @@ ValidHaptic(SDL_Haptic ** haptic)
int valid;

if (*haptic == NULL) {
SDL_SetError("Haptic device hasn't been opened yet");
SDL_SetError("Haptic: Device hasn't been opened yet");
valid = 0;
} else {
valid = 1;
@@ -93,7 +93,7 @@ const char *
SDL_HapticName(int device_index)
{
if ((device_index < 0) || (device_index >= SDL_numhaptics)) {
SDL_SetError("There are %d haptic devices available", SDL_numhaptics);
SDL_SetError("Haptic: There are %d haptic devices available", SDL_numhaptics);
return NULL;
}
return SDL_SYS_HapticName(device_index);
@@ -110,7 +110,7 @@ SDL_HapticOpen(int device_index)
SDL_Haptic *haptic;

if ((device_index < 0) || (device_index >= SDL_numhaptics)) {
SDL_SetError("There are %d haptic devices available", SDL_numhaptics);
SDL_SetError("Haptic: There are %d haptic devices available", SDL_numhaptics);
return NULL;
}

@@ -210,7 +210,7 @@ SDL_HapticOpenFromMouse(void)
device_index = SDL_SYS_HapticMouse();

if (device_index < 0) {
SDL_SetError("Mouse isn't a haptic device.");
SDL_SetError("Haptic: Mouse isn't a haptic device.");
return NULL;
}

@@ -401,7 +401,7 @@ SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect)

/* Check to see if effect is supported */
if (SDL_HapticEffectSupported(haptic,effect)==SDL_FALSE) {
SDL_SetError("Haptic effect not supported by haptic device.");
SDL_SetError("Haptic: Effect not supported by haptic device.");
return -1;
}

@@ -417,7 +417,7 @@ SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect)
}
}

SDL_SetError("Haptic device has no free space left.");
SDL_SetError("Haptic: Device has no free space left.");
return -1;
}

@@ -428,7 +428,7 @@ static int
ValidEffect(SDL_Haptic * haptic, int effect)
{
if ((effect < 0) || (effect >= haptic->neffects)) {
SDL_SetError("Invalid haptic effect identifier.");
SDL_SetError("Haptic: Invalid effect identifier.");
return 0;
}
return 1;
@@ -518,7 +518,7 @@ SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int effect)
}

if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) {
SDL_SetError("Haptic device does not support status queries.");
SDL_SetError("Haptic: Device does not support status queries.");
return -1;
}

@@ -539,12 +539,12 @@ SDL_HapticSetGain(SDL_Haptic * haptic, int gain )
}

if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) {
SDL_SetError("Haptic device does not support setting gain.");
SDL_SetError("Haptic: Device does not support setting gain.");
return -1;
}

if ((gain < 0) || (gain > 100)) {
SDL_SetError("Haptic gain must be between 0 and 100.");
SDL_SetError("Haptic: Gain must be between 0 and 100.");
return -1;
}

@@ -582,12 +582,12 @@ SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter )
}

if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) {
SDL_SetError("Haptic device does not support setting autocenter.");
SDL_SetError("Haptic: Device does not support setting autocenter.");
return -1;
}

if ((autocenter < 0) || (autocenter > 100)) {
SDL_SetError("Haptic autocenter must be between 0 and 100.");
SDL_SetError("Haptic: Autocenter must be between 0 and 100.");
return -1;
}

@@ -94,7 +94,7 @@ EV_IsHaptic(int fd)
/* Ask device for what it has. */
ret = 0;
if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(features)), features) < 0) {
SDL_SetError("Unable to get device's haptic abilities: %s", strerror(errno));
SDL_SetError("Haptic: Unable to get device's features: %s", strerror(errno));
return -1;
}

@@ -257,7 +257,7 @@ SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)

/* Set the effects */
if (ioctl(fd, EVIOCGEFFECTS, &haptic->neffects) < 0) {
SDL_SetError("Unable to query haptic device memory: %s", strerror(errno));
SDL_SetError("Haptic: Unable to query device memory: %s", strerror(errno));
goto open_err;
}
haptic->effects = (struct haptic_effect *)
@@ -294,7 +294,7 @@ SDL_SYS_HapticOpen(SDL_Haptic * haptic)
/* Open the character device */
fd = open(SDL_hapticlist[haptic->index].fname, O_RDWR, 0);
if (fd < 0) {
SDL_SetError("Unable to open %s: %s",
SDL_SetError("Haptic: Unable to open %s: %s",
SDL_hapticlist[haptic->index], strerror(errno));
return -1;
}
@@ -317,7 +317,7 @@ SDL_SYS_HapticMouse(void)
/* Open the device. */
fd = open(SDL_hapticlist[i].fname, O_RDWR, 0);
if (fd < 0) {
SDL_SetError("Unable to open %s: %s",
SDL_SetError("Haptic: Unable to open %s: %s",
SDL_hapticlist[i], strerror(errno));
return -1;
}
@@ -590,7 +590,7 @@ SDL_SYS_ToFFEffect( struct ff_effect * dest, SDL_HapticEffect * src )


default:
SDL_SetError("Unknown haptic effect type");
SDL_SetError("Haptic: Unknown effect type.");
return -1;
}

@@ -624,7 +624,7 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect * effect,

/* Upload the effect */
if (ioctl(haptic->hwdata->fd, EVIOCSFF, linux_effect) < 0) {
SDL_SetError("Error uploading effect to the haptic device: %s", strerror(errno));
SDL_SetError("Haptic: Error uploading effect to the device: %s", strerror(errno));
goto new_effect_err;
}

@@ -656,7 +656,7 @@ int SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,

/* See if it can be uploaded. */
if (ioctl(haptic->hwdata->fd, EVIOCSFF, &linux_effect) < 0) {
SDL_SetError("Error updating the haptic effect: %s", strerror(errno));
SDL_SetError("Haptic: Error updating the effect: %s", strerror(errno));
return -1;
}

@@ -681,7 +681,7 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect)
run.value = 1;

if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) {
SDL_SetError("Unable to run the haptic effect: %s", strerror(errno));
SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));
return -1;
}

@@ -702,7 +702,7 @@ SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect * effect)
stop.value = 0;

if (write(haptic->hwdata->fd, (const void*) &stop, sizeof(stop)) < 0) {
SDL_SetError("Unable to stop the haptic effect: %s", strerror(errno));
SDL_SetError("Haptic: Unable to stop the effect: %s", strerror(errno));
return -1;
}

@@ -717,7 +717,7 @@ void
SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect * effect)
{
if (ioctl(haptic->hwdata->fd, EVIOCRMFF, effect->hweffect->effect.id) < 0) {
SDL_SetError("Error removing the effect from the haptic device: %s",
SDL_SetError("Haptic: Error removing the effect from the device: %s",
strerror(errno));
}
SDL_free(effect->hweffect);
@@ -739,7 +739,7 @@ SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect * effect
ie.code = effect->hweffect->effect.id;

if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
SDL_SetError("Error getting haptic device status.");
SDL_SetError("Haptic: Error getting device status.");
return -1;
}

@@ -763,7 +763,7 @@ SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
ie.value = (0xFFFFUL * gain) / 100;

if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
SDL_SetError("Error setting gain: %s", strerror(errno));
SDL_SetError("Haptic: Error setting gain: %s", strerror(errno));
return -1;
}

@@ -784,7 +784,7 @@ SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
ie.value = (0xFFFFUL * autocenter) / 100;

if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
SDL_SetError("Error setting autocenter: %s", strerror(errno));
SDL_SetError("Haptic: Error setting autocenter: %s", strerror(errno));
return -1;
}

0 comments on commit ff6281b

Please sign in to comment.