d3ru / eggbotcode

Automatically exported from code.google.com/p/eggbotcode
0 stars 0 forks source link

Serial port scan is "unfriendly" #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Originally Reported by westfw, May 25 (4 days ago)
To find the serial port occupied by the eggbot, the extension code sends a
"v\r" (version) command to each port it sees, looking for an appropriate
response.  This may have unintended consequences depending on what other
serial devices are connected to the system, so there should be an easier
way to have the user specify a specific serial port to try.  I suggest an
environment variable ?

Original issue reported on code.google.com by windell@oskay.net on 30 May 2010 at 11:31

GoogleCodeExporter commented 9 years ago
Comment  by brian.schmalz, May 26 (4 days ago) (Copied here by oskay)

I'm curious how else you could do it. Since Windows (in it's infinite wisdom) 
assigns
a different COM port number each time you plug the EggBot into a different 
place in
the USB 'tree', you have no way of knowing from one run to the next where it 
will be.

However, if we stored the last known COM port number in the config file (where 
we
store our other local parameters) then we could search that one first, and only 
do an
exhaustive search if it fails . . . 

Note that there are many other device's software that take this approach to 
finding
which COM port their device is attached too.

From a longer term perspective, I will be adding the ability to set a 'serial 
number'
in Flash in the EBB. The effect of this is that Windows will now tie a single 
COM
port number to a single instance of an EB, no matter where you move it around 
in the
USB 'tree'. This will then help alleviate the 'searching' problem considerably. 

I also have a unique PID/VID combo that I've gotten from Microchip. We could use
this, which would then allow us to have a unique string that the Windows API 
(and
hopefully the Python code) could query after the EB has enumerated. This would 
not
help the problem of how to differentiate multiple EBs on the same computer, but 
would
mean you don't have to open each COM port and send a string to find out which 
one is
an EB. The only downside is that we would no longer have the same .ini file as 
the
Microchip CDC example - we would have to construct our own (that's where the 
string
would come from).

Original comment by windell@oskay.net on 30 May 2010 at 11:32

GoogleCodeExporter commented 9 years ago
Separate OS-specific code was added to improve search for serial ports on Mac, 
Windows, and Linux.  Seems to be working well.

Original comment by windell@oskay.net on 13 Sep 2010 at 9:02