1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-25 16:08:32 +00:00

fix(core): fix USB VCP freeze on T3W1 in prodtest

[no changelog]
This commit is contained in:
cepetr 2025-04-16 12:38:43 +02:00 committed by cepetr
parent 04aeaf0607
commit a05ce8aa70
3 changed files with 14 additions and 8 deletions

View File

@ -50,8 +50,8 @@ typedef struct {
uint8_t ep_out; // Address of OUT endpoint uint8_t ep_out; // Address of OUT endpoint
#endif #endif
uint8_t polling_interval; // In units of 1ms uint8_t polling_interval; // In units of 1ms
uint8_t max_packet_len; // Length of the biggest packet, and of tx_packet and uint16_t max_packet_len; // Length of the biggest packet, and of tx_packet
// rx_packet // and rx_packet
} usb_vcp_info_t; } usb_vcp_info_t;
secbool __wur usb_vcp_add(const usb_vcp_info_t *vcp_info); secbool __wur usb_vcp_add(const usb_vcp_info_t *vcp_info);

View File

@ -152,7 +152,7 @@ typedef struct {
uint8_t ep_cmd; uint8_t ep_cmd;
uint8_t ep_in; uint8_t ep_in;
uint8_t ep_out; uint8_t ep_out;
uint8_t max_packet_len; uint16_t max_packet_len;
uint8_t ep_in_is_idle; // Set to 1 after IN endpoint gets idle uint8_t ep_in_is_idle; // Set to 1 after IN endpoint gets idle
uint8_t cmd_buffer[USB_CDC_MAX_CMD_PACKET_LEN]; uint8_t cmd_buffer[USB_CDC_MAX_CMD_PACKET_LEN];
} usb_vcp_state_t; } usb_vcp_state_t;

View File

@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <trezor_bsp.h>
#include <trezor_model.h> #include <trezor_model.h>
#include <trezor_rtl.h> #include <trezor_rtl.h>
@ -116,12 +117,17 @@ static size_t console_write(void *context, const char *buf, size_t size) {
static void vcp_intr(void) { cli_abort(&g_cli); } static void vcp_intr(void) { cli_abort(&g_cli); }
static void usb_init_all(void) { #if defined(USE_USB_HS)
enum { #define VCP_PACKET_LEN 512
VCP_PACKET_LEN = 64, #elif defined(USE_USB_FS)
VCP_BUFFER_LEN = 1024, #define VCP_PACKET_LEN 64
}; #else
#error "USB type not defined"
#endif
#define VCP_BUFFER_LEN 1024
static void usb_init_all(void) {
static const usb_dev_info_t dev_info = { static const usb_dev_info_t dev_info = {
.device_class = 0xEF, // Composite Device Class .device_class = 0xEF, // Composite Device Class
.device_subclass = 0x02, // Common Class .device_subclass = 0x02, // Common Class