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
+4
View File
@@ -2963,7 +2963,10 @@ int cdcacm_classobject(int minor, FAR struct usbdev_devinfo_s *devinfo,
/* Register the USB serial console */ /* Register the USB serial console */
#ifdef CONFIG_CDCACM_CONSOLE #ifdef CONFIG_CDCACM_CONSOLE
if (minor == 0)
{
priv->serdev.isconsole = true; priv->serdev.isconsole = true;
ret = uart_register("/dev/console", &priv->serdev); ret = uart_register("/dev/console", &priv->serdev);
if (ret < 0) if (ret < 0)
{ {
@@ -2971,6 +2974,7 @@ int cdcacm_classobject(int minor, FAR struct usbdev_devinfo_s *devinfo,
(uint16_t)-ret); (uint16_t)-ret);
goto errout_with_class; goto errout_with_class;
} }
}
#endif #endif
/* Register the CDC/ACM TTY device */ /* Register the CDC/ACM TTY device */