bluetooth: Forward ioctl to btuart lowerhalf driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-10-02 03:34:17 +08:00 committed by Alan Carvalho de Assis
parent fab8b081c0
commit 6ec74d8d36
6 changed files with 30 additions and 0 deletions

View File

@ -306,3 +306,23 @@ void btuart_close(FAR struct bt_driver_s *dev)
lower->rxattach(lower, NULL, NULL);
}
int btuart_ioctl(FAR struct bt_driver_s *dev,
int cmd, unsigned long arg)
{
FAR struct btuart_upperhalf_s *upper;
FAR const struct btuart_lowerhalf_s *lower;
upper = (FAR struct btuart_upperhalf_s *)dev;
DEBUGASSERT(upper != NULL && upper->lower != NULL);
lower = upper->lower;
if (lower->ioctl)
{
return lower->ioctl(lower, cmd, arg);
}
else
{
return -ENOTTY;
}
}

View File

@ -92,5 +92,7 @@ int btuart_send(FAR struct bt_driver_s *dev,
FAR void *data, size_t len);
int btuart_open(FAR struct bt_driver_s *dev);
void btuart_close(FAR struct bt_driver_s *dev);
int btuart_ioctl(FAR struct bt_driver_s *dev,
int cmd, unsigned long arg);
#endif /* __DRIVER_WIRELESS_BLUETOOTH_BT_UART_H */

View File

@ -424,6 +424,7 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
upper->dev.open = btuart_open;
upper->dev.send = btuart_send;
upper->dev.close = btuart_close;
upper->dev.ioctl = btuart_ioctl;
upper->lower = lower;
/* Load firmware */

View File

@ -190,6 +190,7 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
upper->dev.open = btuart_open;
upper->dev.send = btuart_send;
upper->dev.close = btuart_close;
upper->dev.ioctl = btuart_ioctl;
upper->lower = lower;
/* Load firmware */

View File

@ -84,6 +84,7 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
upper->dev.open = btuart_open;
upper->dev.send = btuart_send;
upper->dev.close = btuart_close;
upper->dev.ioctl = btuart_ioctl;
upper->lower = lower;
/* And register the driver with the network and the Bluetooth stack. */

View File

@ -137,6 +137,11 @@ struct btuart_lowerhalf_s
/* Flush/drain all buffered RX data */
CODE ssize_t (*rxdrain)(FAR const struct btuart_lowerhalf_s *lower);
/* Lower-half logic may support platform-specific ioctl commands */
CODE int (*ioctl)(FAR const struct btuart_lowerhalf_s *lower,
int cmd, unsigned long arg);
};
/****************************************************************************