Too many COM ports fix

Hey, @Ian and @Jin

Just wanted to ensure you don’t miss this! There is now a solution for the problem of the FACTORY running out of assignable COM port numbers.

As of PR #162 and the build of ~1 hour ago, there are now four conditions, any of which will cause the BusPirate to enumerate without a unique USB serial number:

  1. firmware was compiled with BP_MANUFACTURING_TEST_MODE (as previously)
  2. storage was unformatted / corrupt / otherwise failed to mount
  3. system configuration file (\bpconfig.bp) has a config setting to disable it
  4. storage mounted properly and contains a file, \FACTORY.USB

In combination, this should allow the factory to avoid this problem.
For example, the following workflow might help visualize the minor changes needed:

  1. When factory first connects a fresh buspirate device:

    • No unique USB serial number because the NAND storage will not have been formatted yet.
  2. At some later point, factory will format the NAND storage…

    • Whatever script causes this must be updated to also immediately create in the root of that FAT volume, named FACTORY.USB.
    • That file’s existence will prevent subsequent reboots of the BusPirate from enumerating with a unique USB serial number, allowing the test process to reboot the device.
    • NOTE: This change must occur ANY time the onboard mass-storage device is re-formatted (as that will remove the file).
  3. As a final step of the manufacturing process, just before disconnecting the device for the final time…

    • The factory scripts should delete the \FACTORY.USB file.
    • Can be done from terminal (rm FACTORY.USB)
    • If done from host, should then use Windows’ “safe remove” function to remove the BusPirate device (ensure file system contents are flushed from Windows Host point of view).

That’s all there is to it … should “just work” with minimal one-time changes and testing on the factory side.

Please let me know if this works for you.

Sincerely,
Henry

P.S. – And consider it an early Christmas present, Ian … since you can now just add the \FACTORY.USB file on your devices, and enjoy this factory-mode style behavior like you wanted. :slight_smile:

2 Likes