serial icon indicating copy to clipboard operation
serial copied to clipboard

list.exe may drop last character

Open lachlanm-git opened this issue 7 months ago • 0 comments

On Windows, it appears that the COM port might end up one byte too short. From some investigation, this appears to be due to assuming the buffer returned is a 0-sentinal: https://github.com/ZigEmbeddedGroup/serial/blob/master/src/serial.zig#L95-L99

This appears not to hold, at least on my testing on Windows 10 with some Bluetooth SPP ports. Here's the motivating output:

list.exe Note the BthModem COM ports are one character too short
  path=\\.\COM,   name=COM,       driver=\Device\BthModem6 
  path=\\.\COM3,  name=COM3,      driver=\Device\BthModem4  
  path=\\.\COM,   name=COM,       driver=\Device\BthModem2 
  path=\\.\COM3,  name=COM3,      driver=\Device\BthModem0 
  path=\\.\COM2,  name=COM2,      driver=\Device\BthModem1 
  path=\\.\COM2,  name=COM2,      driver=\Device\BthModem3 
  path=\\.\COM26, name=COM26,     driver=\Device\VCP0
list_port_info.exe
Port name: COM29
 - System location: \\.\COM29
 - Friendly name: Standard Serial over Bluetooth link (COM29)
 - Description: Standard Serial over Bluetooth link
 - Manufacturer: Microsoft
 - Serial #:
 - HW ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_VID&0001005D_PID&0000\7&102635A6&0&D8197A0582BB_C00000000
 - VID: 0x0000 PID: 0x0000

Port name: COM22
 - System location: \\.\COM22
 - Friendly name: Standard Serial over Bluetooth link (COM22)
 - Description: Standard Serial over Bluetooth link
 - Manufacturer: Microsoft
 - Serial #:
 - HW ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_VID&0001005D_PID&63EA\7&102635A6&0&D8197A0585D3_C00000000
 - VID: 0x0000 PID: 0x0000

Port name: COM31
 - System location: \\.\COM31
 - Friendly name: Standard Serial over Bluetooth link (COM31)
 - Description: Standard Serial over Bluetooth link
 - Manufacturer: Microsoft
 - Serial #:
 - HW ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_VID&0001005D_PID&0000\7&102635A6&0&D8197A01FBAD_C00000000
 - VID: 0x0000 PID: 0x0000

Port name: COM26
 - System location: \\.\COM26
 - Friendly name: USB Serial Port (COM26)
 - Description: USB Serial Port
 - Manufacturer: FTDI
 - Serial #: FT69UUIDA
 - HW ID: FTDIBUS\VID_0403+PID_6001+FT69UUIDA\0000
 - VID: 0x0403 PID: 0x6001

Port name: COM5
 - System location: \\.\COM5
 - Friendly name: Standard Serial over Bluetooth link (COM5)
 - Description: Standard Serial over Bluetooth link
 - Manufacturer: Microsoft
 - Serial #:
 - HW ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0002\7&102635A6&0&08C8C211C297_C00000000
 - VID: 0x0000 PID: 0x0000

Port name: COM24
 - System location: \\.\COM24
 - Friendly name: Standard Serial over Bluetooth link (COM24)
 - Description: Standard Serial over Bluetooth link
 - Manufacturer: Microsoft
 - Serial #:
 - HW ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\7&102635A6&0&000000000000_00000057
 - VID: 0x0000 PID: 0x0000

Port name: COM3
 - System location: \\.\COM3
 - Friendly name: Standard Serial over Bluetooth link (COM3)
 - Description: Standard Serial over Bluetooth link
 - Manufacturer: Microsoft
 - Serial #:
 - HW ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\7&102635A6&0&000000000000_00000080
 - VID: 0x0000 PID: 0x0000

Port name: COM30
 - System location: \\.\COM30
 - Friendly name: Standard Serial over Bluetooth link (COM30)
 - Description: Standard Serial over Bluetooth link
 - Manufacturer: Microsoft
 - Serial #:
 - HW ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\7&102635A6&0&000000000000_00000090
 - VID: 0x0000 PID: 0x0000

I have a fix which I can PR when I have some time soon.

lachlanm-git avatar May 24 '25 01:05 lachlanm-git