Skip to content

Commit

Permalink
Move datapipes variables from mce.h to datapipe.c
Browse files Browse the repository at this point in the history
Duplicates were generated in to every object file that was compiled
from source code that included mce.h. I guess this a) compiled
because the structures are not initialized b) worked because the
runtime linker resolved refs from the plugins to use variables
compiled into mce main binary.

Leave extern declarations to the header, but define the actual
variables only once in the datapipe module.

[mce] Move datapipes variables from mce.h to datapipe.c. Fixes JB#18917
  • Loading branch information
spiiroin committed May 26, 2014
1 parent 2f584eb commit 9ed6763
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 147 deletions.
150 changes: 150 additions & 0 deletions datapipe.c
Expand Up @@ -25,6 +25,156 @@

#include "mce-log.h" /* mce_log(), LL_* */

/* Available datapipes */

/** LED brightness */
datapipe_struct led_brightness_pipe;

/** LPM brightness */
datapipe_struct lpm_brightness_pipe;

/** State of device; read only */
datapipe_struct device_inactive_pipe;

/** LED pattern to activate; read only */
datapipe_struct led_pattern_activate_pipe;

/** LED pattern to deactivate; read only */
datapipe_struct led_pattern_deactivate_pipe;

/** Non-synthetized user activity; read only */
datapipe_struct user_activity_pipe;

/** State of display; read only */
datapipe_struct display_state_pipe;

/** Desired state of display; write only */
datapipe_struct display_state_req_pipe;

/** Next (non-transitional) state of display; read only */
datapipe_struct display_state_next_pipe;

/** exceptional ui state; read write */
datapipe_struct exception_state_pipe;

/**
* Display brightness;
* bits 0-7 is brightness in percent (0-100)
* upper 8 bits is high brightness boost (0-2)
*/
datapipe_struct display_brightness_pipe;

/** Key backlight */
datapipe_struct key_backlight_pipe;

/** A key has been pressed */
datapipe_struct keypress_pipe;

/** Touchscreen activity took place */
datapipe_struct touchscreen_pipe;

/** The lock-key has been pressed; read only */
datapipe_struct lockkey_pipe;

/** Keyboard open/closed; read only */
datapipe_struct keyboard_slide_pipe;

/** Lid cover open/closed; read only */
datapipe_struct lid_cover_pipe;

/** Lens cover open/closed; read only */
datapipe_struct lens_cover_pipe;

/** Proximity sensor; read only */
datapipe_struct proximity_sensor_pipe;

/** Ambient light sensor; read only */
datapipe_struct ambient_light_sensor_pipe;

/** Orientation sensor; read only */
datapipe_struct orientation_sensor_pipe;

/** The alarm UI state */
datapipe_struct alarm_ui_state_pipe;

/** The device state */
datapipe_struct system_state_pipe;

/** Enable/disable radios */
datapipe_struct master_radio_pipe;

/** The device submode */
datapipe_struct submode_pipe;

/** The call state */
datapipe_struct call_state_pipe;

/** The call type */
datapipe_struct call_type_pipe;

/** The touchscreen/keypad lock state */
datapipe_struct tk_lock_pipe;

/** Charger state; read only */
datapipe_struct charger_state_pipe;

/** Battery status; read only */
datapipe_struct battery_status_pipe;

/** Battery charge level; read only */
datapipe_struct battery_level_pipe;

/** Camera button; read only */
datapipe_struct camera_button_pipe;

/** The inactivity timeout; read only */
datapipe_struct inactivity_timeout_pipe;

/** Audio routing state; read only */
datapipe_struct audio_route_pipe;

/** USB cable has been connected/disconnected; read only */
datapipe_struct usb_cable_pipe;

/** A jack connector has been connected/disconnected; read only */
datapipe_struct jack_sense_pipe;

/** Power save mode is active; read only */
datapipe_struct power_saving_mode_pipe;

/** Thermal state; read only */
datapipe_struct thermal_state_pipe;

/** Heartbeat; read only */
datapipe_struct heartbeat_pipe;

/** lipstick availability; read only */
datapipe_struct lipstick_available_pipe;

/** PackageKit Locked status; read only */
datapipe_struct packagekit_locked_pipe;

/** Device Lock active status; read only */
datapipe_struct device_lock_active_pipe;

/** touchscreen input grab required; read/write */
datapipe_struct touch_grab_wanted_pipe;

/** touchscreen input grab active; read only */
datapipe_struct touch_grab_active_pipe;

/** keypad input grab required; read/write */
datapipe_struct keypad_grab_wanted_pipe;

/** keypad input grab active; read only */
datapipe_struct keypad_grab_active_pipe;

/** music playback active; read only */
datapipe_struct music_playback_pipe;

/** proximity blanking; read only */
datapipe_struct proximity_blank_pipe;

/**
* Execute the input triggers of a datapipe
*
Expand Down
196 changes: 49 additions & 147 deletions mce.h
Expand Up @@ -305,153 +305,55 @@ typedef enum {
UIEXC_NOTIF = 1<<3,
} uiexctype_t;

/** LED brightness */
datapipe_struct led_brightness_pipe;

/** LPM brightness */
datapipe_struct lpm_brightness_pipe;

/** State of device; read only */
datapipe_struct device_inactive_pipe;

/** LED pattern to activate; read only */
datapipe_struct led_pattern_activate_pipe;

/** LED pattern to deactivate; read only */
datapipe_struct led_pattern_deactivate_pipe;

/** Non-synthetized user activity; read only */
datapipe_struct user_activity_pipe;

/** State of display; read only */
datapipe_struct display_state_pipe;

/** Desired state of display; write only */
datapipe_struct display_state_req_pipe;

/** Next (non-transitional) state of display; read only */
datapipe_struct display_state_next_pipe;

/** exceptional ui state; read write */
datapipe_struct exception_state_pipe;

/**
* Display brightness;
* bits 0-7 is brightness in percent (0-100)
* upper 8 bits is high brightness boost (0-2)
*/
datapipe_struct display_brightness_pipe;

/** Key backlight */
datapipe_struct key_backlight_pipe;

/** A key has been pressed */
datapipe_struct keypress_pipe;

/** Touchscreen activity took place */
datapipe_struct touchscreen_pipe;

/** The lock-key has been pressed; read only */
datapipe_struct lockkey_pipe;

/** Keyboard open/closed; read only */
datapipe_struct keyboard_slide_pipe;

/** Lid cover open/closed; read only */
datapipe_struct lid_cover_pipe;

/** Lens cover open/closed; read only */
datapipe_struct lens_cover_pipe;

/** Proximity sensor; read only */
datapipe_struct proximity_sensor_pipe;

/** Ambient light sensor; read only */
datapipe_struct ambient_light_sensor_pipe;

/** Orientation sensor; read only */
datapipe_struct orientation_sensor_pipe;

/** The alarm UI state */
datapipe_struct alarm_ui_state_pipe;

/** The device state */
datapipe_struct system_state_pipe;

/** Enable/disable radios */
datapipe_struct master_radio_pipe;

/** The device submode */
datapipe_struct submode_pipe;

/** The call state */
datapipe_struct call_state_pipe;

/** The call type */
datapipe_struct call_type_pipe;

/** The touchscreen/keypad lock state */
datapipe_struct tk_lock_pipe;

/** Charger state; read only */
datapipe_struct charger_state_pipe;

/** Battery status; read only */
datapipe_struct battery_status_pipe;

/** Battery charge level; read only */
datapipe_struct battery_level_pipe;

/** Camera button; read only */
datapipe_struct camera_button_pipe;

/** The inactivity timeout; read only */
datapipe_struct inactivity_timeout_pipe;

/** Audio routing state; read only */
datapipe_struct audio_route_pipe;

/** USB cable has been connected/disconnected; read only */
datapipe_struct usb_cable_pipe;

/** A jack connector has been connected/disconnected; read only */
datapipe_struct jack_sense_pipe;

/** Power save mode is active; read only */
datapipe_struct power_saving_mode_pipe;

/** Thermal state; read only */
datapipe_struct thermal_state_pipe;

/** Heartbeat; read only */
datapipe_struct heartbeat_pipe;

/** lipstick availability; read only */
datapipe_struct lipstick_available_pipe;

/** PackageKit Locked status; read only */
datapipe_struct packagekit_locked_pipe;

/** Device Lock active status; read only */
datapipe_struct device_lock_active_pipe;

/** touchscreen input grab required; read/write */
datapipe_struct touch_grab_wanted_pipe;

/** touchscreen input grab active; read only */
datapipe_struct touch_grab_active_pipe;

/** keypad input grab required; read/write */
datapipe_struct keypad_grab_wanted_pipe;

/** keypad input grab active; read only */
datapipe_struct keypad_grab_active_pipe;

/** music playback active; read only */
datapipe_struct music_playback_pipe;

/** proximity blanking; read only */
datapipe_struct proximity_blank_pipe;
/* Available datapipes */
extern datapipe_struct led_brightness_pipe;
extern datapipe_struct lpm_brightness_pipe;
extern datapipe_struct device_inactive_pipe;
extern datapipe_struct led_pattern_activate_pipe;
extern datapipe_struct led_pattern_deactivate_pipe;
extern datapipe_struct user_activity_pipe;
extern datapipe_struct display_state_pipe;
extern datapipe_struct display_state_req_pipe;
extern datapipe_struct display_state_next_pipe;
extern datapipe_struct exception_state_pipe;
extern datapipe_struct display_brightness_pipe;
extern datapipe_struct key_backlight_pipe;
extern datapipe_struct keypress_pipe;
extern datapipe_struct touchscreen_pipe;
extern datapipe_struct lockkey_pipe;
extern datapipe_struct keyboard_slide_pipe;
extern datapipe_struct lid_cover_pipe;
extern datapipe_struct lens_cover_pipe;
extern datapipe_struct proximity_sensor_pipe;
extern datapipe_struct ambient_light_sensor_pipe;
extern datapipe_struct orientation_sensor_pipe;
extern datapipe_struct alarm_ui_state_pipe;
extern datapipe_struct system_state_pipe;
extern datapipe_struct master_radio_pipe;
extern datapipe_struct submode_pipe;
extern datapipe_struct call_state_pipe;
extern datapipe_struct call_type_pipe;
extern datapipe_struct tk_lock_pipe;
extern datapipe_struct charger_state_pipe;
extern datapipe_struct battery_status_pipe;
extern datapipe_struct battery_level_pipe;
extern datapipe_struct camera_button_pipe;
extern datapipe_struct inactivity_timeout_pipe;
extern datapipe_struct audio_route_pipe;
extern datapipe_struct usb_cable_pipe;
extern datapipe_struct jack_sense_pipe;
extern datapipe_struct power_saving_mode_pipe;
extern datapipe_struct thermal_state_pipe;
extern datapipe_struct heartbeat_pipe;
extern datapipe_struct lipstick_available_pipe;
extern datapipe_struct packagekit_locked_pipe;
extern datapipe_struct device_lock_active_pipe;
extern datapipe_struct touch_grab_wanted_pipe;
extern datapipe_struct touch_grab_active_pipe;
extern datapipe_struct keypad_grab_wanted_pipe;
extern datapipe_struct keypad_grab_active_pipe;
extern datapipe_struct music_playback_pipe;
extern datapipe_struct proximity_blank_pipe;

/* XXX: use HAL */

Expand Down

0 comments on commit 9ed6763

Please sign in to comment.