Advertisement
techmik

Untitled

Sep 28th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. static int set_light_notifications(struct light_device_t* dev,
  2.             struct light_state_t const* state)
  3. {
  4.     if (state->flashOnMS == 0 && state->flashOffMS == 0)
  5.     return;
  6.  
  7.     int brightness =  rgb_to_brightness(state);
  8.     int v = 0;
  9.     int ret = 0;
  10.     pthread_mutex_lock(&g_lock);
  11.  
  12.     if (brightness+state->color == 0 || brightness > 100) {
  13.         if (state->color & 0x00ffffff)
  14.             v = 1;
  15.     } else
  16.         v = 0;
  17.  
  18.     LOGI("color %u fm %u status %u is lit %u brightness", state->color, state->flashMode, v, (state->color & 0x00ffffff), brightness);
  19.     ret = write_int(LED_FILE, v);
  20.     pthread_mutex_unlock(&g_lock);
  21.     return ret;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement