1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/* Copyright 2010 Stefan Tomanek <stefan.tomanek+th@wertarbyte.de>
* You have permission to copy, modify, and redistribute under the
* terms of the GPLv3 or any later version.
* For full license terms, see COPYING.
*/
#include <stdio.h>
#include "devices.h"
#include "command.h"
#include "keystate.h"
#include "trigger.h"
#include "thd.h"
int obey_command( struct command *cmd ) {
if (cmd->type == CMD_ADD) {
add_device( cmd->param, -1, cmd->exclusive, cmd->tag );
return 0;
}
if (cmd->type == CMD_PASSFD) {
add_device( cmd->param, cmd->fd, cmd->exclusive, cmd->tag );
return 0;
}
if (cmd->type == CMD_REMOVE) {
remove_device( cmd->param );
return 0;
}
if (cmd->type == CMD_QUIT) {
cleanup();
return 0;
}
if (cmd->type == CMD_ENABLE) {
triggers_enabled(1);
return 0;
}
if (cmd->type == CMD_DISABLE) {
triggers_enabled(0);
return 0;
}
if (cmd->type == CMD_CLEARDEVS) {
clear_devices();
return 0;
}
if (cmd->type == CMD_CHANGEMODE) {
change_trigger_mode( cmd->param );
return 0;
}
return 1;
}
|