mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 14:08:52 +08:00
pwm_input: add argc check
This commit is contained in:
@@ -267,6 +267,7 @@ static void pwmin_start();
|
||||
static void pwmin_info(void);
|
||||
static void pwmin_test(void);
|
||||
static void pwmin_reset(void);
|
||||
static void pwmin_usage(void);
|
||||
|
||||
static PWMIN *g_dev;
|
||||
|
||||
@@ -647,12 +648,21 @@ static void pwmin_info(void)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void pwmin_usage()
|
||||
{
|
||||
PX4_ERR("unrecognized command, try 'start', 'info', 'reset' or 'test'");
|
||||
}
|
||||
|
||||
/*
|
||||
* driver entry point
|
||||
*/
|
||||
int pwm_input_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
pwmin_usage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *verb = argv[1];
|
||||
|
||||
/*
|
||||
@@ -683,6 +693,6 @@ int pwm_input_main(int argc, char *argv[])
|
||||
pwmin_reset();
|
||||
}
|
||||
|
||||
errx(1, "unrecognized command, try 'start', 'info', 'reset' or 'test'");
|
||||
return 0;
|
||||
pwmin_usage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user