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

add usb_device #7520

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from
Open

add usb_device #7520

wants to merge 17 commits into from

Conversation

tomaszduda23
Copy link
Contributor

@tomaszduda23 tomaszduda23 commented Oct 1, 2024

What does this implement/fix?

show status of usb device. Part of #3917. It is also applicable for cdc logger.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • esp32 s2
  • esp32 s3

Example entry for config.yaml:

binary_sensor:
  - platform: usb_device
    configured:
      name: USB is configured

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

esphome/esphome-docs#4295

@probot-esphome
Copy link

probot-esphome bot commented Oct 1, 2024

Hey there @tomaszduda23,
Thanks for submitting this pull request! Can you add yourself as a codeowner for this integration? This way we can notify you if a bug report for this integration is reported.
In __init__.py of the integration, please add:

CODEOWNERS = ["@tomaszduda23"]

And run script/build_codeowners.py

(message by NeedsCodeownersLabel)

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.02%. Comparing base (4d8b5ed) to head (152a4ab).
Report is 1416 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #7520      +/-   ##
==========================================
+ Coverage   53.70%   54.02%   +0.31%     
==========================================
  Files          50       50              
  Lines        9408     9697     +289     
  Branches     1654     1711      +57     
==========================================
+ Hits         5053     5239     +186     
- Misses       4056     4127      +71     
- Partials      299      331      +32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tomaszduda23 tomaszduda23 marked this pull request as ready for review October 1, 2024 16:04
#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
#include "usb_device.h"
#include "esphome/core/log.h"
#include "USB.h"
Copy link
Member

Choose a reason for hiding this comment

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

This is an Arduino Library, new esp32 components should be directly using esp-idf headers and functions, not Arduino ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. There are 2 cases:

  1. Arduino uses tinyusb for cdc logger
  2. esp-idf use in rom cdc

@esphome esphome bot marked this pull request as draft October 6, 2024 23:01
@esphome
Copy link

esphome bot commented Oct 6, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@tomaszduda23 tomaszduda23 marked this pull request as ready for review October 7, 2024 22:40
@esphome esphome bot requested a review from jesserockz October 7, 2024 22:40
@tomaszduda23 tomaszduda23 mentioned this pull request Oct 9, 2024
18 tasks
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.

3 participants