我在嵌入式系统上有一个USB驱动程序,正在将数据插入端口32k。但是,当我使用pyserial读取数据时,它将数据分成4k数据包。这是一个USB 2.0,我不想重新组合数据。
这是我读取数据的方式:
data = serial.read(1)
data += serial.read(serial.inWaiting())
if (len(data) > 32):
header_size = int(32)
data_header = data[:header_size]
#just show the first 32 characters of the data
print("Packet size = " + str(len(data)) + "\n")
print(str(data_header) + "\n")
输出:
Packet size = 4096
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Packet size = 4096
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
Packet size = 4096
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
Packet size = 4096
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Packet size = 4096
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Packet size = 4096
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Packet size = 4096
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Packet size = 4096
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
是驱动程序限制还是pyserial正在拆分数据?可以配置吗?
谢谢。