mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:49:12 +08:00
aerofc: forbid gpio changes
We export an "empty" table, but there's no protection when doing ioctl().
This commit is contained in:
committed by
Lorenz Meier
parent
fdb5a92873
commit
66628a4cf1
@@ -2560,7 +2560,11 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
case GPIO_SET_OUTPUT_HIGH:
|
case GPIO_SET_OUTPUT_HIGH:
|
||||||
case GPIO_SET_INPUT:
|
case GPIO_SET_INPUT:
|
||||||
case GPIO_SET_ALT_1:
|
case GPIO_SET_ALT_1:
|
||||||
|
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
|
||||||
|
ret = -EINVAL;
|
||||||
|
#else
|
||||||
gpio_set_function(arg, cmd);
|
gpio_set_function(arg, cmd);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GPIO_SET_ALT_2:
|
case GPIO_SET_ALT_2:
|
||||||
@@ -2571,11 +2575,19 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
case GPIO_SET:
|
case GPIO_SET:
|
||||||
case GPIO_CLEAR:
|
case GPIO_CLEAR:
|
||||||
|
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
|
||||||
|
ret = -EINVAL;
|
||||||
|
#else
|
||||||
gpio_write(arg, cmd);
|
gpio_write(arg, cmd);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GPIO_GET:
|
case GPIO_GET:
|
||||||
|
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
|
||||||
|
ret = -EINVAL;
|
||||||
|
#else
|
||||||
*(uint32_t *)arg = gpio_read();
|
*(uint32_t *)arg = gpio_read();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user