Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename keyboard slide and availability signals & methods
Using signals/state data names with "keypad" causes confusion.

When dealing with input devices that are expected to be qwerty
keyboards, use names that have "keyboard" instead of "keypad".
  • Loading branch information
spiiroin committed Jan 8, 2015
1 parent 19e6c04 commit fbc2d10
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 52 deletions.
22 changes: 11 additions & 11 deletions event-input.c
Expand Up @@ -232,7 +232,7 @@ typedef enum {
EVDEV_VOLKEY,

/** Keyboard device */
EVDEV_KEYPAD,
EVDEV_KEYBOARD,

} evin_evdevtype_t;

Expand Down Expand Up @@ -1235,7 +1235,7 @@ evin_evdevtype_repr(evin_evdevtype_t type)
[EVDEV_PS] = "PROXIMITY SENSOR",
[EVDEV_ALS] = "AMBIENT LIGHT SENSOR",
[EVDEV_VOLKEY] = "VOLUME KEYS",
[EVDEV_KEYPAD] = "KEYPAD",
[EVDEV_KEYBOARD] = "KEYBOARD",
};

return lut[type];
Expand Down Expand Up @@ -1374,7 +1374,7 @@ evin_evdevtype_from_info(evin_evdevinfo_t *info)

/* Presense of keyboard devices needs to be signaled */
if( evin_evdevinfo_is_keyboard(info) ) {
res = EVDEV_KEYPAD;
res = EVDEV_KEYBOARD;
goto cleanup;
}

Expand Down Expand Up @@ -2205,7 +2205,7 @@ evin_iomon_device_add(const gchar *path)
break;

case EVDEV_INPUT:
case EVDEV_KEYPAD:
case EVDEV_KEYBOARD:
notify = evin_iomon_keypress_cb;
break;

Expand Down Expand Up @@ -2404,7 +2404,7 @@ evin_iomon_switch_states_update(void)
0);
}

/** Iterator callback for evaluation availability of keypad input devices
/** Iterator callback for evaluation availability of keyboard input devices
*
* Note: The iteration is peforming a logical OR operation, so the
* result variable must be modified only to set it true.
Expand All @@ -2424,16 +2424,16 @@ evin_iomon_keyboard_state_update_iter_cb(gpointer io_monitor, gpointer user_data

int ecode = evin_event_mapper_rlookup_switch(SW_KEYPAD_SLIDE);

/* Devices that do not have keypad slide switch are considered
* to be always available. */
/* Keyboard devices that do not have keypad slide switch are
* considered to be always available. */

if( !evin_evdevinfo_has_code(extra->ex_info, EV_SW, ecode) ) {
*avail = true;
goto EXIT;
}

/* Devices that have keypad slide are considered available only
* when the slider is in open state */
/* Keyboard devices that have keypad slide are considered available
* only when the slider is in open state */

int fd = mce_io_mon_get_fd(iomon);

Expand All @@ -2453,7 +2453,7 @@ evin_iomon_keyboard_state_update_iter_cb(gpointer io_monitor, gpointer user_data
return;
}

/** Check if at least one keypad device in usable state exists
/** Check if at least one keyboard device in usable state exists
*
* Iterate over monitored input devices to find normal keyboards
* or slide in keyboards in open position.
Expand All @@ -2468,7 +2468,7 @@ evin_iomon_keyboard_state_update(void)
{
bool available = false;

evin_iomon_device_iterate(EVDEV_KEYPAD,
evin_iomon_device_iterate(EVDEV_KEYBOARD,
evin_iomon_keyboard_state_update_iter_cb,
&available);

Expand Down
82 changes: 41 additions & 41 deletions tklock.c
Expand Up @@ -310,11 +310,11 @@ static void tklock_ui_disable_lpm(void);

// dbus ipc

static void tklock_dbus_send_keypad_slide_state(DBusMessage *const req);
static gboolean tklock_dbus_keypad_slide_state_get_req_cb(DBusMessage *const msg);
static void tklock_dbus_send_keyboard_slide_state(DBusMessage *const req);
static gboolean tklock_dbus_keyboard_slide_state_get_req_cb(DBusMessage *const msg);

static void tklock_dbus_send_keypad_available_state(DBusMessage *const req);
static gboolean tklock_dbus_keypad_available_state_get_req_cb(DBusMessage *const msg);
static void tklock_dbus_send_keyboard_available_state(DBusMessage *const req);
static gboolean tklock_dbus_keyboard_available_state_get_req_cb(DBusMessage *const msg);

static gboolean tklock_dbus_send_tklock_mode(DBusMessage *const method_call);

Expand Down Expand Up @@ -1529,7 +1529,7 @@ tklock_datapipe_keyboard_slide_output_cb(gconstpointer const data)

mce_log(LL_DEBUG, "kbd_slide_output_state = %d -> %d", prev, kbd_slide_output_state);

tklock_dbus_send_keypad_slide_state(0);
tklock_dbus_send_keyboard_slide_state(0);

EXIT:
return;
Expand All @@ -1549,7 +1549,7 @@ tklock_datapipe_keyboard_available_cb(gconstpointer const data)

mce_log(LL_DEBUG, "kbd_available_state = %d -> %d", prev, kbd_available_state);

tklock_dbus_send_keypad_available_state(0);
tklock_dbus_send_keyboard_available_state(0);

EXIT:
return;
Expand Down Expand Up @@ -1835,7 +1835,7 @@ static datapipe_binding_t tklock_datapipe_triggers[] =

},
{
/* Note: Keypad slider state signaling must reflect
/* Note: Keybaord slide state signaling must reflect
* the actual state -> uses output triggering
* unlike the display state logic that is bound
* to datapipe input. */
Expand Down Expand Up @@ -1865,9 +1865,9 @@ static datapipe_binding_t tklock_datapipe_triggers[] =
.input_cb = tklock_datapipe_camera_button_cb,
},
{
/* Note: Logically we should use output trigger for keypad slide,
/* Note: Logically we should use output trigger for keyboard slide,
* but input triggering is used to avoid turning display
* on if mce happens to restart while keypad is open.
* on if mce happens to restart while keyboard is open.
* As long as the slide input is not filtered, there is
* no harm in this. */
.datapipe = &keyboard_slide_pipe,
Expand Down Expand Up @@ -4209,24 +4209,24 @@ static void tklock_ui_disable_lpm(void)
* DBUS MESSAGE HANDLERS
* ========================================================================= */

#define MCE_KEYPAD_SLIDE_STATE_SIG "keypad_slide_state_ind"
#define MCE_KEYPAD_SLIDE_STATE_REQ "keypad_slide_state_req"
#define MCE_KEYBOARD_SLIDE_STATE_SIG "keyboard_slide_state_ind"
#define MCE_KEYBOARD_SLIDE_STATE_REQ "keyboard_slide_state_req"

/** Send the keypad open/closed state
/** Send the keyboard slide open/closed state
*
* @param req A method call message to be replied, or
* NULL send a keypad state signal instead
* NULL to broadcast a keypad state signal
*/
static void
tklock_dbus_send_keypad_slide_state(DBusMessage *const req)
tklock_dbus_send_keyboard_slide_state(DBusMessage *const req)
{
DBusMessage *rsp = 0;

if( req )
rsp = dbus_new_method_reply(req);
else
rsp = dbus_new_signal(MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
MCE_KEYPAD_SLIDE_STATE_SIG);
MCE_KEYBOARD_SLIDE_STATE_SIG);
if( !rsp )
goto EXIT;

Expand All @@ -4238,7 +4238,7 @@ tklock_dbus_send_keypad_slide_state(DBusMessage *const req)
default: break;
}

mce_log(LL_DEBUG, "send keypad slide state %s: %s",
mce_log(LL_DEBUG, "send keyboard slide state %s: %s",
req ? "reply" : "signal", arg);

if( !dbus_message_append_args(rsp,
Expand All @@ -4252,41 +4252,41 @@ tklock_dbus_send_keypad_slide_state(DBusMessage *const req)
if( rsp ) dbus_message_unref(rsp);
}

/** D-Bus callback for the get keypad state method call
/** D-Bus callback for the get keyboard slide state method call
*
* @param msg The D-Bus message
*
* @return TRUE
*/
static gboolean
tklock_dbus_keypad_slide_state_get_req_cb(DBusMessage *const msg)
tklock_dbus_keyboard_slide_state_get_req_cb(DBusMessage *const msg)
{
mce_log(LL_DEVEL, "Received keypad slide state get request from %s",
mce_log(LL_DEVEL, "Received keyboard slide state get request from %s",
mce_dbus_get_message_sender_ident(msg));

tklock_dbus_send_keypad_slide_state(msg);
tklock_dbus_send_keyboard_slide_state(msg);

return TRUE;
}

#define MCE_KEYPAD_AVAILABLE_STATE_SIG "keypad_available_state_ind"
#define MCE_KEYPAD_AVAILABLE_STATE_REQ "keypad_available_state_req"
#define MCE_KEYBOARD_AVAILABLE_STATE_SIG "keyboard_available_state_ind"
#define MCE_KEYBOARD_AVAILABLE_STATE_REQ "keyboard_available_state_req"

/** Send the keypad open/closed state
/** Send the keyboard available state
*
* @param req A method call message to be replied, or
* NULL send a keypad state signal instead
* NULL to broadcast a keyboard available state signal
*/
static void
tklock_dbus_send_keypad_available_state(DBusMessage *const req)
tklock_dbus_send_keyboard_available_state(DBusMessage *const req)
{
DBusMessage *rsp = 0;

if( req )
rsp = dbus_new_method_reply(req);
else
rsp = dbus_new_signal(MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
MCE_KEYPAD_AVAILABLE_STATE_SIG);
MCE_KEYBOARD_AVAILABLE_STATE_SIG);
if( !rsp )
goto EXIT;

Expand All @@ -4298,7 +4298,7 @@ tklock_dbus_send_keypad_available_state(DBusMessage *const req)
default: break;
}

mce_log(LL_DEBUG, "send keypad available state %s: %s",
mce_log(LL_DEBUG, "send keyboard available state %s: %s",
req ? "reply" : "signal", arg);

if( !dbus_message_append_args(rsp,
Expand All @@ -4312,19 +4312,19 @@ tklock_dbus_send_keypad_available_state(DBusMessage *const req)
if( rsp ) dbus_message_unref(rsp);
}

/** D-Bus callback for the get keypad state method call
/** D-Bus callback for the get keyboard available state method call
*
* @param msg The D-Bus message
*
* @return TRUE
*/
static gboolean
tklock_dbus_keypad_available_state_get_req_cb(DBusMessage *const msg)
tklock_dbus_keyboard_available_state_get_req_cb(DBusMessage *const msg)
{
mce_log(LL_DEVEL, "Received keypad available state get request from %s",
mce_log(LL_DEVEL, "Received keyboard available state get request from %s",
mce_dbus_get_message_sender_ident(msg));

tklock_dbus_send_keypad_available_state(msg);
tklock_dbus_send_keyboard_available_state(msg);

return TRUE;
}
Expand Down Expand Up @@ -4635,17 +4635,17 @@ static mce_dbus_handler_t tklock_dbus_handlers[] =
},
{
.interface = MCE_SIGNAL_IF,
.name = MCE_KEYPAD_SLIDE_STATE_SIG,
.name = MCE_KEYBOARD_SLIDE_STATE_SIG,
.type = DBUS_MESSAGE_TYPE_SIGNAL,
.args =
" <arg name=\"keypad_state\" type=\"s\"/>\n"
" <arg name=\"slide_state\" type=\"s\"/>\n"
},
{
.interface = MCE_SIGNAL_IF,
.name = MCE_KEYPAD_AVAILABLE_STATE_SIG,
.name = MCE_KEYBOARD_AVAILABLE_STATE_SIG,
.type = DBUS_MESSAGE_TYPE_SIGNAL,
.args =
" <arg name=\"keypad_state\" type=\"s\"/>\n"
" <arg name=\"keyboard_state\" type=\"s\"/>\n"
},
/* method calls */
{
Expand Down Expand Up @@ -4693,19 +4693,19 @@ static mce_dbus_handler_t tklock_dbus_handlers[] =
},
{
.interface = MCE_REQUEST_IF,
.name = MCE_KEYPAD_SLIDE_STATE_REQ,
.name = MCE_KEYBOARD_SLIDE_STATE_REQ,
.type = DBUS_MESSAGE_TYPE_METHOD_CALL,
.callback = tklock_dbus_keypad_slide_state_get_req_cb,
.callback = tklock_dbus_keyboard_slide_state_get_req_cb,
.args =
" <arg direction=\"out\" name=\"keypad_state\" type=\"s\"/>\n"
" <arg direction=\"out\" name=\"slide_state\" type=\"s\"/>\n"
},
{
.interface = MCE_REQUEST_IF,
.name = MCE_KEYPAD_AVAILABLE_STATE_REQ,
.name = MCE_KEYBOARD_AVAILABLE_STATE_REQ,
.type = DBUS_MESSAGE_TYPE_METHOD_CALL,
.callback = tklock_dbus_keypad_available_state_get_req_cb,
.callback = tklock_dbus_keyboard_available_state_get_req_cb,
.args =
" <arg direction=\"out\" name=\"keypad_state\" type=\"s\"/>\n"
" <arg direction=\"out\" name=\"keyboard_state\" type=\"s\"/>\n"
},
/* sentinel */
{
Expand Down

0 comments on commit fbc2d10

Please sign in to comment.