USBシリアルポートのポート番号をリセットする
WinDDKにdevcon.exeなるものが付属するので使えるようにPATHを通します。
例えばこんなかんじ。
> set PATH=C:\WinDDK\7600.16385.1\tools\devcon\amd64;%PATH% > devcon devcon Usage: devcon [-r] [-m:\\<machine>] <command> [<arg>...] For more information, type: devcon help
現状のWindowsがどのデバイスをどのポート番号に割り当てているか確認するには
> devcon findall =ports
で確認できます。
私の環境ではこんな感じです。
devcon findall =ports USB\VID_067B&PID_2303\6&42CA04E&0&14 : Prolific USB-to-Serial Comm Port (COM12) FTDIBUS\VID_0403+PID_6001+A7043PBTA\0000 : USB Serial Port (COM10) FTDIBUS\VID_0403+PID_6001+FTDVN77ZA\0000 : USB Serial Port (COM3) FTDIBUS\VID_0403+PID_6015+DN03AIAMA\0000 : USB Serial Port (COM13) FTDIBUS\VID_0F87+PID_1037+A3KP4JVA\0000 : USB-401 RS232C[A] (COM1) FTDIBUS\VID_0403+PID_6015+DN03AA4GA\0000 : USB Serial Port (COM11) FTDIBUS\VID_0F87+PID_1038+B3HWFX4A\0000 : USB-401 RS232C[E] (COM5) FTDIBUS\VID_0F87+PID_1037+A3KP4JVB\0000 : USB-401 RS232C[B] (COM2) FTDIBUS\VID_0403+PID_6015+DN03AF5KA\0000 : USB Serial Port (COM9) FTDIBUS\VID_0F87+PID_1038+B3HWFX4B\0000 : USB-401 RS232C[F] (COM6) FTDIBUS\VID_0F87+PID_1037+A3KP4JVC\0000 : USB-401 RS232C[C] (COM3) FTDIBUS\VID_0F87+PID_1038+B3HWFX4C\0000 : USB-401 RS232C[G] (COM7) FTDIBUS\VID_0F87+PID_1037+A3KP4JVD\0000 : USB-401 RS232C[D] (COM4) FTDIBUS\VID_0F87+PID_1038+B3HWFX4D\0000 : USB-401 RS232C[H] (COM8) USB\VID_067B&PID_2303\6&16164B29&0&3 : Prolific USB-to-Serial Comm Port (COM15) 15 matching device(s) found.
見やすくすると以下。
デバイスPATH | 名前 | ポート |
---|---|---|
FTDIBUS\VID_0F87+PID_1037+A3KP4JVA\0000 | USB-401 RS232C[A] | (COM1) |
FTDIBUS\VID_0403+PID_6001+A7043PBTA\0000 | USB Serial Port | (COM10) |
FTDIBUS\VID_0403+PID_6015+DN03AA4GA\0000 | USB Serial Port | (COM11) |
USB\VID_067B&PID_2303\6&42CA04E&0&14 | Prolific USB-to-Serial Comm Port | (COM12) |
FTDIBUS\VID_0403+PID_6015+DN03AIAMA\0000 | USB Serial Port | (COM13) |
USB\VID_067B&PID_2303\6&16164B29&0&3 | Prolific USB-to-Serial Comm Port | (COM15) |
FTDIBUS\VID_0F87+PID_1037+A3KP4JVB\0000 | USB-401 RS232C[B] | (COM2) |
FTDIBUS\VID_0403+PID_6001+FTDVN77ZA\0000 | USB Serial Port | (COM3) |
FTDIBUS\VID_0F87+PID_1037+A3KP4JVC\0000 | USB-401 RS232C[C] | (COM3) |
FTDIBUS\VID_0F87+PID_1037+A3KP4JVD\0000 | USB-401 RS232C[D] | (COM4) |
FTDIBUS\VID_0F87+PID_1038+B3HWFX4A\0000 | USB-401 RS232C[E] | (COM5) |
FTDIBUS\VID_0F87+PID_1038+B3HWFX4B\0000 | USB-401 RS232C[F] | (COM6) |
FTDIBUS\VID_0F87+PID_1038+B3HWFX4C\0000 | USB-401 RS232C[G] | (COM7) |
FTDIBUS\VID_0F87+PID_1038+B3HWFX4D\0000 | USB-401 RS232C[H] | (COM8) |
FTDIBUS\VID_0403+PID_6015+DN03AF5KA\0000 | USB Serial Port | (COM9) |
COM3が2つあり、FTDIBUS\VID_0403+PID_6001+FTDVN77ZA\0000 これは削除したい。
この場合
> devcon remove "@FTDIBUS\VID_0403+PID_6001+FTDVN77ZA\0000" FTDIBUS\VID_0403+PID_6001+FTDVN77ZA\0000 : Remove failed No devices were removed.
削除失敗しました。
コマンドプロンプトを管理者権限で開けば多分OK。
> devcon remove "@FTDIBUS\VID_0403+PID_6001+FTDVN77ZA\0000" FTDIBUS\VID_0403+PID_6001+FTDVN77ZA\0000 : Removed 1 device(s) were removed.
できた。