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

Is it possible to provide an ncm_open, ncm_close API interface to control the connection and disconnection of USB? #2669

Open
1 task done
tswen opened this issue Jun 11, 2024 · 2 comments

Comments

@tswen
Copy link

tswen commented Jun 11, 2024

Related area

net class

Hardware specification

esp32-S2, esp32-S3

Is your feature request related to a problem?

None

Describe the solution you'd like

None

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.
@tswen
Copy link
Author

tswen commented Jun 11, 2024

Such as

void ecm_close(void)
{
  printf("Ecm close\n");
  tusb_control_request_t notify_data =
  {
    .bmRequestType = 0xA1,
    .bRequest = 0 /* NETWORK_CONNECTION aka NetworkConnection */,
    .wValue = 0 /* Disconnected */,
    .wLength = 0,
  };
  notify_data.wIndex = _netd_itf.itf_num;
  netd_report((uint8_t *)&notify_data, sizeof(notify_data));
}

void ecm_open(void)
{
  printf("Ecm OPEN\n");
  tusb_control_request_t notify_data =
  {
    .bmRequestType = 0xA1,
    .bRequest = 0 /* NETWORK_CONNECTION aka NetworkConnection */,
    .wValue = 1 /* Connected */,
    .wLength = 0,
  };
  notify_data.wIndex = _netd_itf.itf_num;
  netd_report((uint8_t *)&notify_data, sizeof(notify_data));
}

@JustAnother1
Copy link

you could use the already defined tu_static struct ncm_notify_t ncm_notify_connected to implement these functions, right?

Wouldn't it also make sense to define the startup behavior? Currently it just automatically is connected. That is a good default behavior. But in a scenario where the firmware wants to change the connected state it might also want to start out in disconnected state, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants