From e4a5aae99eb8c3ce0a68a77da5859d6fd575aae1 Mon Sep 17 00:00:00 2001 From: endolf Date: Tue, 30 Aug 2005 19:54:25 +0000 Subject: It appears as though linux can't cope with scaling the effect, it's on or off. So i'm having to play with the strong/weak rumble settings. git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@121 e343933a-64c8-49c5-92b1-88f2ce3e89e8 --- plugins/linux/src/native/EventDevice.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'plugins/linux/src') diff --git a/plugins/linux/src/native/EventDevice.cpp b/plugins/linux/src/native/EventDevice.cpp index d5cefbf..b77f2b7 100644 --- a/plugins/linux/src/native/EventDevice.cpp +++ b/plugins/linux/src/native/EventDevice.cpp @@ -430,7 +430,7 @@ void EventDevice::rumble(float force) { if(force<-1) force=-1; //LOG_TRACE("Rumbling at %d%%, (shh, pretend)\n", (int)(force*100)); - if(effect_playing==true && force==0) { + if(effect_playing==true) { stop.type=EV_FF; stop.code = effect.id; stop.value=0; @@ -441,6 +441,24 @@ void EventDevice::rumble(float force) { effect_playing=false; } } + + if(force>0.666666) { + effect.u.rumble.strong_magnitude = (int)(0x8000*force); + effect.u.rumble.weak_magnitude = (int)(0xc000*force); + } else if(force>0.3333333) { + effect.u.rumble.strong_magnitude = (int)(0x8000*force); + effect.u.rumble.weak_magnitude = (int)(0xc000*0); + } else { + effect.u.rumble.strong_magnitude = (int)(0x8000*0); + effect.u.rumble.weak_magnitude = (int)(0xc000*force); + } + + LOG_TRACE("Uploading effect %d\n", effect.id); + if (ioctl(fd, EVIOCSFF, &effect) == -1) { + perror("Upload effect"); + } + LOG_TRACE("Uploaded effect %d\n", effect.id); + if(effect_playing==false && force!=0) { play.type = EV_FF; play.code=effect.id; -- cgit v1.2.3