Skip to content

Conversation

@jfischer-no
Copy link
Contributor

@jfischer-no jfischer-no commented Feb 1, 2022

usb: add option to initialize USB device support at boot


This patch adds new board specific Kconfig option
BL654_USB_SERIAL_BACKEND_CDCACM, which is enabled by
default except USB_DEVICE_BLUETOOTH class is used.
Applications that depend on usb_enable() or do not
require composite configuration cannot be used
with BL654 USB board without user intervention.

Fixes: #39904

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this if statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(⊙.☉)7, probably c&p

@nordicjm
Copy link
Contributor

nordicjm commented Feb 2, 2022

This doesn't solve the issue if users still need to supply a random Kconfig when building projects. #39987 fixes this without needing user intervention and providing an easy user experience

@jfischer-no
Copy link
Contributor Author

This doesn't solve the issue if users still need to supply a random Kconfig when building projects. #39987 fixes this without needing user intervention and providing an easy user experience

According to my understanding it is not possible and I have tried to explain it to you several times. Probably I am missing something, can you explain to me in what miraculous way it happens that option CONFIG_BOARD_ENABLE_USB_AUTOMATICALLY in #39987 is activated?

@nordicjm
Copy link
Contributor

nordicjm commented Feb 2, 2022

This doesn't solve the issue if users still need to supply a random Kconfig when building projects. #39987 fixes this without needing user intervention and providing an easy user experience

According to my understanding it is not possible and I have tried to explain it to you several times. Probably I am missing something, can you explain to me in what miraculous way it happens that option CONFIG_BOARD_ENABLE_USB_AUTOMATICALLY in #39987 is activated?

I built an application and it worked, so going off that which I also explained to you several times, yes, it is possible and works.

config USB_UART_CONSOLE
	default y if !USB_DEVICE_BLUETOOTH

config BOARD_ENABLE_USB_AUTOMATICALLY
	bool "Enable USB automatically"
	default y if USB_UART_CONSOLE

If USB_DEVICE_BLUETOOTH is not set, then USB_UART_CONSOLE is set, if this is set then BOARD_ENABLE_USB_AUTOMATICALLY is set which then enables USB automatically at startup without any Kconfigs being specified in the build options via command line

@zephyrbot zephyrbot added the platform: nRF Nordic nRFx label Feb 2, 2022
@zephyrbot zephyrbot requested a review from anangl February 2, 2022 14:05
Possibility to initialize USB device support is useful when
only CDC ACM class is enabled and CDC ACM UART is used as
backend for console, shell, or logging.

Signed-off-by: Johann Fischer <[email protected]>
This patch adds new board specific Kconfig option
BL654_USB_SERIAL_BACKEND_CDCACM, which is enabled by
default except USB_DEVICE_BLUETOOTH class is used.
Applications that depend on usb_enable() or do not
require composite configuration cannot be used
with BL654 USB board without user intervention.

Signed-off-by: Johann Fischer <[email protected]>
@jfischer-no jfischer-no force-pushed the pr-workaround-serial-backend-for-boards-like-nrf52840dongle branch from 1c723f0 to b7856d7 Compare February 3, 2022 10:24
@jfischer-no
Copy link
Contributor Author

config USB_UART_CONSOLE
	default y if !USB_DEVICE_BLUETOOTH

config BOARD_ENABLE_USB_AUTOMATICALLY
	bool "Enable USB automatically"
	default y if USB_UART_CONSOLE

If USB_DEVICE_BLUETOOTH is not set, then USB_UART_CONSOLE is set, if this is set then BOARD_ENABLE_USB_AUTOMATICALLY is set which then enables USB automatically at startup without any Kconfigs being specified in the build options via command line

There is no USB_UART_CONSOLE, but assuming it describes exact behavior desired by you, it is the same as:

config BOARD_ENABLE_USB_AUTOMATICALLY
	bool "Enable USB automatically"
	default y if !USB_DEVICE_BLUETOOTH

or with 951633e,

config BL654_USB_SERIAL_BACKEND_CDCACM
	bool "Use CDC ACM UART as backend for BL654 USB adapter"
	default y if !USB_DEVICE_BLUETOOTH
	help
	  Use CDC ACM UART as backend for console or shell.

if BL654_USB_SERIAL_BACKEND_CDCACM

config USB_DEVICE_INITIALIZE_AT_BOOT
	default y

...

endif #BL654_USB_SERIAL_BACKEND_CDCACM

Is it correct so far? If yes please approve and accept the resulting disadvantages.

@jfischer-no jfischer-no changed the title boards like nrf52840dongle: use CDC ACM UART as serial backend boards: bl654_usb: use CDC ACM UART as serial backend Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bl654_usb does not work with hci_usb sample application

5 participants