Advertisement
techmik

Untitled

Sep 27th, 2011
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.10 KB | None | 0 0
  1. static int set_light_notifications(struct light_device_t* dev,
  2.             struct light_state_t const* state)
  3. {
  4.     int brightness =  rgb_to_brightness(state);
  5.     int v = 0;
  6.     int ret = 0;
  7.     pthread_mutex_lock(&g_lock);
  8.  
  9.     if (brightness+state->color == 0 || brightness > 100) {
  10.         if (state->color & 0x00ffffff)
  11.             v = 1;
  12.     } else
  13.         v = 0;
  14.  
  15.     LOGI("color %u fm %u status %u is lit %u brightness", state->color, state->flashMode, v, (state->color & 0x00ffffff), brightness);
  16.     ret = write_int(LED_FILE, v);
  17.     pthread_mutex_unlock(&g_lock);
  18.     return ret;
  19. }
  20.  
  21.  
  22. ## COPIED ***
  23.  
  24.  
  25.  
  26. static int set_light_buttons(struct light_device_t* dev,
  27.             struct light_state_t const* state)
  28. {
  29.     int brightness =  rgb_to_brightness(state);
  30.     int v = 0;
  31.     int ret = 0;
  32.     pthread_mutex_lock(&g_lock);
  33.  
  34.     if (brightness+state->color == 0 || brightness > 100) {
  35.         if (state->color & 0x00ffffff)
  36.             v = 1;
  37.     } else
  38.         v = 0;
  39.  
  40.     LOGI("color %u fm %u status %u is lit %u brightness", state->color, state->flashMode, v, (state->color & 0x00ffffff), brightness);
  41.     ret = write_int(LED_FILE, v);
  42.     pthread_mutex_unlock(&g_lock);
  43.     return ret;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement