vfs_usb_serial: set secondary selection for making usb port can output under default menu

This commit is contained in:
Cao Sen Miao
2021-10-21 12:46:24 +08:00
parent b4ef1b80a2
commit 0f2aa2eae4
16 changed files with 488 additions and 175 deletions

View File

@@ -1,16 +1,8 @@
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include <stdbool.h>
@@ -969,31 +961,37 @@ static int uart_tcflush(int fd, int select)
}
#endif // CONFIG_VFS_SUPPORT_TERMIOS
void esp_vfs_dev_uart_register(void)
{
esp_vfs_t vfs = {
.flags = ESP_VFS_FLAG_DEFAULT,
.write = &uart_write,
.open = &uart_open,
.fstat = &uart_fstat,
.close = &uart_close,
.read = &uart_read,
.fcntl = &uart_fcntl,
.fsync = &uart_fsync,
static const esp_vfs_t vfs = {
.flags = ESP_VFS_FLAG_DEFAULT,
.write = &uart_write,
.open = &uart_open,
.fstat = &uart_fstat,
.close = &uart_close,
.read = &uart_read,
.fcntl = &uart_fcntl,
.fsync = &uart_fsync,
#ifdef CONFIG_VFS_SUPPORT_DIR
.access = &uart_access,
.access = &uart_access,
#endif // CONFIG_VFS_SUPPORT_DIR
#ifdef CONFIG_VFS_SUPPORT_SELECT
.start_select = &uart_start_select,
.end_select = &uart_end_select,
.start_select = &uart_start_select,
.end_select = &uart_end_select,
#endif // CONFIG_VFS_SUPPORT_SELECT
#ifdef CONFIG_VFS_SUPPORT_TERMIOS
.tcsetattr = &uart_tcsetattr,
.tcgetattr = &uart_tcgetattr,
.tcdrain = &uart_tcdrain,
.tcflush = &uart_tcflush,
.tcsetattr = &uart_tcsetattr,
.tcgetattr = &uart_tcgetattr,
.tcdrain = &uart_tcdrain,
.tcflush = &uart_tcflush,
#endif // CONFIG_VFS_SUPPORT_TERMIOS
};
};
const esp_vfs_t* esp_vfs_uart_get_vfs(void)
{
return &vfs;
}
void esp_vfs_dev_uart_register(void)
{
ESP_ERROR_CHECK(esp_vfs_register("/dev/uart", &vfs, NULL));
}