Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[USB Serial/JTAG] [VFS] add flag if driver has ever received bytes (IDFGH-8651) #10097

Conversation

chipweinberger
Copy link
Contributor

@chipweinberger chipweinberger commented Nov 2, 2022

Related issue: #9366

This PR was spun out from #9983

introduces: usb_serial_jtag_has_driver_received_bytes();

I need a way to detect if a USB terminal is attached, so that I can decide which port to open my terminal on. If the user types a character over USB during boot, I open USB Console, otherwise I open UART Console.

(I also send a 'terminal probe request' during boot, so USB Console detection is automatic for most terminals 😊)

I like that this solution is less complex (i.e. more reliable) than calling read() or initializing linenoise or esp_console.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 2, 2022
@github-actions github-actions bot changed the title [USB Serial/JTAG] [VFS] add flag if driver has ever received bytes [USB Serial/JTAG] [VFS] add flag if driver has ever received bytes (IDFGH-8651) Nov 2, 2022
@igrr igrr requested a review from mythbuster5 November 2, 2022 20:10
@chipweinberger chipweinberger force-pushed the user/chip/add-flag-for-usb-serial-jtag-input branch 5 times, most recently from 495e62a to 2c79bf9 Compare November 8, 2022 12:18
@CLAassistant
Copy link

CLAassistant commented Nov 8, 2022

CLA assistant check
All committers have signed the CLA.

@chipweinberger chipweinberger force-pushed the user/chip/add-flag-for-usb-serial-jtag-input branch from 2c79bf9 to ba7252b Compare November 9, 2022 00:20
@chipweinberger
Copy link
Contributor Author

chipweinberger commented Nov 9, 2022

Looking around for alternatives, maybe I could instead use this function?

static inline int usb_serial_jtag_ll_rxfifo_data_available(void)

I'd just need to make sure nothing else reads the data, but I think thats already the case unless I initialize the usb_serial_jtag_driver.

@chipweinberger
Copy link
Contributor Author

chipweinberger commented Nov 15, 2022

I'll test usb_serial_jtag_ll_rxfifo_data_available, and possibly close this PR if I find it to be sufficient. But, adding this flag would still be a better approach.

Edit: ah damn, just noticed its a static function. I can't call it... We should just add this flag, its so much simpler.

@chipweinberger
Copy link
Contributor Author

Closing this PR.

This functionality can now be better implemented with bool usb_serial_jtag_is_connected(void) which was added to master on Februrary 26, 2023. 1a66459

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Won't Do This will not be worked on and removed Status: Opened Issue is new labels Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants