comparison input/input.c @ 5218:11c7ccce8ae3

Added options -input keylist and -input cmdlist to list all know keys and commands
author albeu
date Wed, 20 Mar 2002 13:30:57 +0000
parents 022c957633a3
children 8a01cde9cf39
comparison
equal deleted inserted replaced
5217:3e7152b383ca 5218:11c7ccce8ae3
114 { JOY_AXIS0_MINUS, "JOY_LEFT" }, 114 { JOY_AXIS0_MINUS, "JOY_LEFT" },
115 { JOY_AXIS0_PLUS, "JOY_RIGHT" }, 115 { JOY_AXIS0_PLUS, "JOY_RIGHT" },
116 116
117 { JOY_AXIS0_PLUS, "JOY_AXIS0_PLUS" }, 117 { JOY_AXIS0_PLUS, "JOY_AXIS0_PLUS" },
118 { JOY_AXIS0_MINUS, "JOY_AXIS0_MINUS" }, 118 { JOY_AXIS0_MINUS, "JOY_AXIS0_MINUS" },
119 { JOY_AXIS1_PLUS, " JOY_AXIS1_PLUS" }, 119 { JOY_AXIS1_PLUS, "JOY_AXIS1_PLUS" },
120 { JOY_AXIS1_MINUS, "JOY_AXIS1_MINUS" }, 120 { JOY_AXIS1_MINUS, "JOY_AXIS1_MINUS" },
121 { JOY_AXIS2_PLUS, "JOY_AXIS2_PLUS" }, 121 { JOY_AXIS2_PLUS, "JOY_AXIS2_PLUS" },
122 { JOY_AXIS2_MINUS, "JOY_AXIS2_MINUS" }, 122 { JOY_AXIS2_MINUS, "JOY_AXIS2_MINUS" },
123 { JOY_AXIS3_PLUS, " JOY_AXIS3_PLUS" }, 123 { JOY_AXIS3_PLUS, "JOY_AXIS3_PLUS" },
124 { JOY_AXIS3_MINUS, "JOY_AXIS3_MINUS" }, 124 { JOY_AXIS3_MINUS, "JOY_AXIS3_MINUS" },
125 { JOY_AXIS4_PLUS, "JOY_AXIS4_PLUS" }, 125 { JOY_AXIS4_PLUS, "JOY_AXIS4_PLUS" },
126 { JOY_AXIS4_MINUS, "JOY_AXIS4_MINUS" }, 126 { JOY_AXIS4_MINUS, "JOY_AXIS4_MINUS" },
127 { JOY_AXIS5_PLUS, " JOY_AXIS5_PLUS" }, 127 { JOY_AXIS5_PLUS, "JOY_AXIS5_PLUS" },
128 { JOY_AXIS5_MINUS, "JOY_AXIS5_MINUS" }, 128 { JOY_AXIS5_MINUS, "JOY_AXIS5_MINUS" },
129 { JOY_AXIS6_PLUS, "JOY_AXIS6_PLUS" }, 129 { JOY_AXIS6_PLUS, "JOY_AXIS6_PLUS" },
130 { JOY_AXIS6_MINUS, "JOY_AXIS6_MINUS" }, 130 { JOY_AXIS6_MINUS, "JOY_AXIS6_MINUS" },
131 { JOY_AXIS7_PLUS, " JOY_AXIS7_PLUS" }, 131 { JOY_AXIS7_PLUS, "JOY_AXIS7_PLUS" },
132 { JOY_AXIS7_MINUS, "JOY_AXIS7_MINUS" }, 132 { JOY_AXIS7_MINUS, "JOY_AXIS7_MINUS" },
133 { JOY_AXIS8_PLUS, "JOY_AXIS8_PLUS" }, 133 { JOY_AXIS8_PLUS, "JOY_AXIS8_PLUS" },
134 { JOY_AXIS8_MINUS, "JOY_AXIS8_MINUS" }, 134 { JOY_AXIS8_MINUS, "JOY_AXIS8_MINUS" },
135 { JOY_AXIS9_PLUS, " JOY_AXIS9_PLUS" }, 135 { JOY_AXIS9_PLUS, "JOY_AXIS9_PLUS" },
136 { JOY_AXIS9_MINUS, "JOY_AXIS9_MINUS" }, 136 { JOY_AXIS9_MINUS, "JOY_AXIS9_MINUS" },
137 137
138 { JOY_BTN0, "JOY_BTN0" }, 138 { JOY_BTN0, "JOY_BTN0" },
139 { JOY_BTN1, "JOY_BTN1" }, 139 { JOY_BTN1, "JOY_BTN1" },
140 { JOY_BTN2, "JOY_BTN2" }, 140 { JOY_BTN2, "JOY_BTN2" },
276 static unsigned int ar_delay = 100, ar_rate = 8, last_ar = 0; 276 static unsigned int ar_delay = 100, ar_rate = 8, last_ar = 0;
277 277
278 static int use_joystick = 1, use_lirc = 1; 278 static int use_joystick = 1, use_lirc = 1;
279 static char* config_file = "input.conf"; 279 static char* config_file = "input.conf";
280 280
281 static int mp_input_print_key_list(config_t* cfg);
282 static int mp_input_print_cmd_list(config_t* cfg);
283
281 // Our command line options 284 // Our command line options
282 static config_t input_conf[] = { 285 static config_t input_conf[] = {
283 { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL }, 286 { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
284 { "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL }, 287 { "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
285 { "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL }, 288 { "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
289 { "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
290 { "cmdlist", mp_input_print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
286 { NULL, NULL, 0, 0, 0, 0, NULL} 291 { NULL, NULL, 0, 0, 0, 0, NULL}
287 }; 292 };
288 293
289 static config_t mp_input_opts[] = { 294 static config_t mp_input_opts[] = {
290 { "input", &input_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, 295 { "input", &input_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
1245 void 1250 void
1246 mp_input_register_options(m_config_t* cfg) { 1251 mp_input_register_options(m_config_t* cfg) {
1247 m_config_register_options(cfg,mp_input_opts); 1252 m_config_register_options(cfg,mp_input_opts);
1248 } 1253 }
1249 1254
1255 static int mp_input_print_key_list(config_t* cfg) {
1256 int i;
1257 printf("\n");
1258 for(i= 0; key_names[i].name != NULL ; i++)
1259 printf("%s\n",key_names[i].name);
1260 exit(0);
1261 }
1262
1263 static int mp_input_print_cmd_list(config_t* cfg) {
1264 mp_cmd_t *cmd;
1265 int i,j;
1266 char* type;
1267
1268 for(i = 0; (cmd = &mp_cmds[i])->name != NULL ; i++) {
1269 printf("%-20.20s",cmd->name);
1270 for(j= 0 ; j < MP_CMD_MAX_ARGS && cmd->args[j].type != -1 ; j++) {
1271 switch(cmd->args[j].type) {
1272 case MP_CMD_ARG_INT:
1273 type = "Integer";
1274 break;
1275 case MP_CMD_ARG_FLOAT:
1276 type = "Float";
1277 break;
1278 case MP_CMD_ARG_STRING:
1279 type = "String";
1280 break;
1281 default:
1282 type = "??";
1283 }
1284 if(j+1 > cmd->nargs)
1285 printf(" [%s]",type);
1286 else
1287 printf(" %s",type);
1288 }
1289 printf("\n");
1290 }
1291 exit(0);
1292 }
1293
1250 #endif /* HAVE_NEW_INPUT */ 1294 #endif /* HAVE_NEW_INPUT */