usbdev/cdcacm.c: register console only for device with minor number 0

With this change, we can register several CDCACM devices where one is used as a console
This commit is contained in:
raiden00pl
2023-06-14 15:57:26 +02:00
committed by Alan Carvalho de Assis
parent 2f58b55b4d
commit 387944b837
+10 -6
View File
@@ -2963,13 +2963,17 @@ int cdcacm_classobject(int minor, FAR struct usbdev_devinfo_s *devinfo,
/* Register the USB serial console */
#ifdef CONFIG_CDCACM_CONSOLE
priv->serdev.isconsole = true;
ret = uart_register("/dev/console", &priv->serdev);
if (ret < 0)
if (minor == 0)
{
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_CONSOLEREGISTER),
(uint16_t)-ret);
goto errout_with_class;
priv->serdev.isconsole = true;
ret = uart_register("/dev/console", &priv->serdev);
if (ret < 0)
{
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_CONSOLEREGISTER),
(uint16_t)-ret);
goto errout_with_class;
}
}
#endif