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 option to open a CDC device with any VID or PID #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tore-espressif
Copy link
Collaborator

@tore-espressif tore-espressif commented Oct 2, 2024

Description

The CDC driver must support also devices who do not follow the CDC specification. Any many cases, the user does not know or care about the device's VID/PID. With this feautere, any device can be opened

Testing

A test is added that checks all positive (device opened) and negative (device not opened) cases

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@tore-espressif tore-espressif self-assigned this Oct 2, 2024
@tore-espressif tore-espressif changed the title Add option to oepn a CDC device with any VID or PID Add option to open a CDC device with any VID or PID Oct 2, 2024
}

// Allocate memory for the functional descriptors pointers
cdc_func_array_t *func_desc = malloc(func_desc_cnt * (sizeof(usb_standard_desc_t *)));

Check warning

Code scanning / clang-tidy

Call to 'malloc' has an allocation size of 0 bytes [clang-analyzer-optin.portability.UnixAPI] Warning

Call to 'malloc' has an allocation size of 0 bytes [clang-analyzer-optin.portability.UnixAPI]
}

// Allocate memory for the functional descriptors pointers
cdc_func_array_t *func_desc = malloc(func_desc_cnt * (sizeof(usb_standard_desc_t *)));

Check warning

Code scanning / clang-tidy

Result of 'malloc' is converted to a pointer of type 'cdc_func_array_t', which is incompatible with sizeof operand type 'usb_standard_desc_t *' [clang-analyzer-unix.MallocSizeof] Warning

Result of 'malloc' is converted to a pointer of type 'cdc_func_array_t', which is incompatible with sizeof operand type 'usb_standard_desc_t *' [clang-analyzer-unix.MallocSizeof]
{
int desc_offset = 0;

memset(info_ret, 0, sizeof(cdc_parsed_info_t));

Check warning

Code scanning / clang-tidy

Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning

Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
The Receive buffer append function changes location of the data buffer.
While this works fine on S2 and S3, it will crash on P4 because now we must do
cache sync for the data buffer. This will crash on unaligned cache sync,
so this feature is disabled on P4 for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant