Remove need to specify values for usb pedal rumble effects.
This commit is contained in:
parent
8cbc21b1a0
commit
e211b35c9d
|
|
@ -5,15 +5,34 @@
|
||||||
|
|
||||||
#include "usbhapticdevice.h"
|
#include "usbhapticdevice.h"
|
||||||
|
|
||||||
|
#include "../../helper/confighelper.h"
|
||||||
#include "../slog/slog.h"
|
#include "../slog/slog.h"
|
||||||
|
|
||||||
const char* SYSFSRUMBLEPATH = "/sys/module/hid_fanatec/drivers/hid:ftec_csl_elite/0003:0EB7:183B.*/rumble";
|
const char* SYSFSRUMBLEPATH = "/sys/module/hid_fanatec/drivers/hid:ftec_csl_elite/0003:0EB7:183B.*/rumble";
|
||||||
|
|
||||||
|
|
||||||
int cslelitev3_update(USBGenericHapticDevice* usbhapticdevice, int value)
|
int cslelitev3_update(USBGenericHapticDevice* usbhapticdevice, int effecttype, int play)
|
||||||
{
|
{
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
int value = 0;
|
||||||
|
|
||||||
|
if (play > 0)
|
||||||
|
{
|
||||||
|
switch (effecttype)
|
||||||
|
{
|
||||||
|
case (EFFECT_TYRESLIP):
|
||||||
|
value = 0xff0000;
|
||||||
|
break;
|
||||||
|
case (EFFECT_TYRELOCK):
|
||||||
|
value = 0xff00;
|
||||||
|
break;
|
||||||
|
case (EFFECT_ABSBRAKES):
|
||||||
|
value = 0xffff00;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fprintf(usbhapticdevice->handle, "%i\n", value);
|
fprintf(usbhapticdevice->handle, "%i\n", value);
|
||||||
fflush(usbhapticdevice->handle);
|
fflush(usbhapticdevice->handle);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef _CSLELITEV3_H
|
#ifndef _CSLELITEV3_H
|
||||||
#define _CSLELITEV3_H
|
#define _CSLELITEV3_H
|
||||||
|
|
||||||
int cslelitev3_update(USBGenericHapticDevice* usbhapticdevice, int value);
|
int cslelitev3_update(USBGenericHapticDevice* usbhapticdevice, int effecttype, int play);
|
||||||
int cslelitev3_init(USBGenericHapticDevice* usbhapticdevice);
|
int cslelitev3_init(USBGenericHapticDevice* usbhapticdevice);
|
||||||
int cslelitev3_free(USBGenericHapticDevice* usbhapticdevice);
|
int cslelitev3_free(USBGenericHapticDevice* usbhapticdevice);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@ int usbhapticdev_update(USBGenericHapticDevice* usbhapticdevice, SimData* simdat
|
||||||
{
|
{
|
||||||
if(play > 0)
|
if(play > 0)
|
||||||
{
|
{
|
||||||
cslelitev3_update(usbhapticdevice, usbhapticdevice->value1);
|
cslelitev3_update(usbhapticdevice, usbhapticdevice->effecttype, play);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cslelitev3_update(usbhapticdevice, usbhapticdevice->value0);
|
cslelitev3_update(usbhapticdevice, usbhapticdevice->effecttype, play);
|
||||||
}
|
}
|
||||||
usbhapticdevice->state = play;
|
usbhapticdevice->state = play;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -333,25 +333,7 @@ int devsetup(const char* device_type, const char* device_subtype, const char* co
|
||||||
|
|
||||||
if (ds->dev_subtype == SIMDEVTYPE_USBHAPTIC)
|
if (ds->dev_subtype == SIMDEVTYPE_USBHAPTIC)
|
||||||
{
|
{
|
||||||
if (device_settings != NULL)
|
// logic for different devices
|
||||||
{
|
|
||||||
ds->usbdevsettings.value0 = 0;
|
|
||||||
ds->usbdevsettings.value1 = 1;
|
|
||||||
|
|
||||||
const char* temp;
|
|
||||||
int found = config_setting_lookup_string(device_settings, "devpath", &temp);
|
|
||||||
if (found == 0)
|
|
||||||
{
|
|
||||||
ds->usbdevsettings.dev = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ds->usbdevsettings.dev = strdup(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
config_setting_lookup_int(device_settings, "value0", &ds->usbdevsettings.value0);
|
|
||||||
config_setting_lookup_int(device_settings, "value1", &ds->usbdevsettings.value1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds->dev_subtype == SIMDEVTYPE_USBHAPTIC || ds->dev_type == SIMDEV_SOUND) {
|
if (ds->dev_subtype == SIMDEVTYPE_USBHAPTIC || ds->dev_type == SIMDEV_SOUND) {
|
||||||
|
|
@ -433,12 +415,5 @@ int settingsfree(DeviceSettings ds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dev_type == SIMDEV_USB)
|
|
||||||
{
|
|
||||||
if (ds.usbdevsettings.dev != NULL )
|
|
||||||
{
|
|
||||||
free(ds.usbdevsettings.dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue