Skip to content

Commit

Permalink
star: Add missing bits
Browse files Browse the repository at this point in the history
Fix the vibrator stop thread again, and add the Settings config
  • Loading branch information
rmcc committed Oct 30, 2012
1 parent 933d28d commit afcca8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions overlay/packages/apps/Settings/res/values/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<bool name="has_led_flash">true</bool>
</resources>
4 changes: 2 additions & 2 deletions vibrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ static void enable_stop_thread(int timeout_ms) {
static void disable_stop_thread() {
/* This may create dangling threads, but since bionic has no
pthread_cancel(), it's the best I can come up with */
int dummy = 0;
if (stop_pending && !pthread_kill( vibstop_pt, 0 ))
pthread_detach( vibstop_pt );
stop_pending = 0;
ioctl(tspfd,TSPDRV_DISABLE_AMP,&dummy);
}

int sendit(int timeout_ms)
Expand All @@ -90,15 +92,13 @@ int sendit(int timeout_ms)
tspfd = open("/dev/tspdrv",O_RDWR);

if (timeout_ms) {
ioctl(tspfd,TSPDRV_DISABLE_AMP,&actuator);
disable_stop_thread();
ioctl(tspfd,TSPDRV_ENABLE_AMP,&actuator);
ioctl(tspfd,TSPDRV_MAGIC_NUMBER,&actuator);
write(tspfd,&vibsample,4); // First hit triggers the sample processing
write(tspfd,&vibsample,4); // Now do it for real
enable_stop_thread(timeout_ms);
} else {
ioctl(tspfd,TSPDRV_DISABLE_AMP,&actuator);
disable_stop_thread();
}

Expand Down

0 comments on commit afcca8a

Please sign in to comment.