Skip to content

[vfs_tinyusb] static struct cause register twice missing the first (IEC-397) #285

@kaidegit

Description

@kaidegit

Answers checklist.

  • I have read the component documentation ESP-IDF Components and the issue is not addressed there.
  • I am using target and esp-idf version as defined in component's idf_component.yml
  • I have searched the issue tracker for a similar issue and not found any related issue.

Which component are you using? If you choose Other, provide details in More Information.

device/esp_tinyusb

ESP-IDF version.

release/v5.4

Development Kit.

ESP32S3-Devkit

Used Component version.

1.7.6~2

More Information.

When call the vfs reg func twice, it will only output with the last one.

    tinyusb_config_cdcacm_t acm_cfg = {
        .usb_dev = 0,
        .cdc_port = TINYUSB_CDC_ACM_0,
        .callback_rx = NULL,
        .callback_rx_wanted_char = NULL,
        .callback_line_state_changed = NULL,
        .callback_line_coding_changed = NULL
    };
    ESP_ERROR_CHECK(tusb_cdc_acm_init(&acm_cfg));

    acm_cfg.cdc_port = TINYUSB_CDC_ACM_1;
    ESP_ERROR_CHECK(tusb_cdc_acm_init(&acm_cfg));

    esp_vfs_tusb_cdc_register(TINYUSB_CDC_ACM_0, path_0);
    esp_vfs_tusb_cdc_register(TINYUSB_CDC_ACM_1, path_1);

    const char* path = path_0;
    ESP_LOGI(TAG, "stdio -> %s", path);
    stdin = fopen(path, "r");
    stdout = fopen(path, "w");
    stderr = stdout;

    while (1) {
       // output in the path_1 cdc port
        ESP_LOGI(TAG, "%s: hello world", path);
        vTaskDelay(pdMS_TO_TICKS(1000));
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions