Port scanner

This forum is for the discussion of other projects on Megasquirt/Microsquirt hardware that don't fit into any of the other forums

Moderators: jsmcortina, muythaibxr

Post Reply
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Port scanner

Post by racingmini_mtl »

I have made a small application that reads all the serial ports on the computer to see if there is any MS-compatible device connected to them. If the device connected is an MS2 or MS3 (any variant) then the CAN bus is also scanned to list all the devices connected to the CAN bus. The application only checks the serial ports at 115200 baud so an MS1 will not be listed; this limitation is due to the fact that this is used mostly to scan the CAN bus and all the MS-compatible devices that are CAN bus enabled use a serial port at 115200 baud (as far as I know).

The application runs on Windows only at this time (I just started using this development kit and I can run the application on Linux but making it distributable to other computers without having to install the whole SDK is turning out to be an annoyingly frustrating experience). You simply need to download this (18Mb download) and double click on port_scanner.exe and click on the "Scan ports" button (note that it may take a few seconds before it displays anything; the example below takes more than a few seconds).

This is what you will see:

Image

This is an example done on my computer with an extreme example of what you could see after clicking on the "Scan ports" button and waiting for the result:

Image

I extended the window to show all the ports and devices scanned (but you can simply scroll through the results if you prefer):

Image

If you hover the mouse over a port or a device, that item name becomes italic and you get the information about the port or the device firmware whether the device is connected to a serial port of a CAN bus. You can see below (note that the mouse cursor is not visible in those screenshots but you can see what is selected because the text is in italic):
  • a port with a USB to serial adapter with an FTDI chipset
  • an MS3 with the pre1.3 alpha 9 firmware (the full definition does appear but is cut here since it falls outside the captured window)
  • an IOx with the V0.1.1 firmware (the full definition does appear but is cut here since it falls outside the captured window)
ImageImageImage

If an MS-compatible device is connected to either a serial port or a CAN bus but cannot be identified by the application, you will get "Unknown device" as the name but you will still get the firmware identification if the device can provide it. This assumes that the devices use the same standards as all the MS2/Extra and MS3 firmware versions (all of my devices respect those standards).

This will eventually be expanded to include the IOx downloader and other utilities. So you will no longer need to select a downloader version depending on which IOx variant you have, which device it is connected to or if it is connected to a serial port or a CAN bus. You will also be able to change the CAN ID and set the RTC time from this upcoming version.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
93white3400z
Master MS/Extra'er
Posts: 685
Joined: Mon Aug 25, 2008 11:37 pm
Location: Montreal, Quebec

Re: Port scanner

Post by 93white3400z »

Cool stuff! It will be pretty cool with the IOx downloader stuff integrated into it.

Any reason for not using Java ? It sure would have been nice for the portability point of view. I bet it's C++ (which dev kit btw ?, I'm surprised at the size) because that's what you're used to work with, that would be a good enough reason for me :)
1993 Chevrolet Cavalier Z24
3400 Turbocharged Inter-cooled
MS3 v3.57+MS3X
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Port scanner

Post by racingmini_mtl »

It uses Qt. I wanted to give it a try and this looked like a good project (and yes it does use c++). It's supposed to be multiplatform but I'm not sure it is going to be easy to actually do.

And the size comes from the fact that you need to include the runtime libraries (I did it the lazy way here). There is no external runtime environment like Java.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
93white3400z
Master MS/Extra'er
Posts: 685
Joined: Mon Aug 25, 2008 11:37 pm
Location: Montreal, Quebec

Re: Port scanner

Post by 93white3400z »

Fair enough ;) I guess eventually you can separate the download of the dlls and the exe for the app itself, and just have the user download the exe when it is updated (unless the libs need updated as well obviously!).

I just tried it and I like it, it would actually have been useful a week or two ago for the new CAN project I'm working on. :) It's pretty fast to scan everything, it might just be missing a thread so the port scanning doesn't happen in the UI thread and freezes it a bit but otherwise it looks pretty cool!

I took a screenshot, I got two ports that are saying "Transmission problem", not sure if that's expected or not, so I thought I would let you know.
1993 Chevrolet Cavalier Z24
3400 Turbocharged Inter-cooled
MS3 v3.57+MS3X
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Port scanner

Post by racingmini_mtl »

That's interesting. What are those ports? That message would mean that the port was opened and configured but for some reason the app was not able to write to the port for the initial 'Q' command. Maybe I need longer time outs.

And you're right that the exe could be separated from the dlls since they should not need updating.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Port scanner

Post by jsmcortina »

Did this ever become cross-platform?

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Port scanner

Post by racingmini_mtl »

Not yet. I was hoping it would be easy to port but it wasn't obvious to me. But that may be because that's my first time using Qt.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Port scanner

Post by jsmcortina »

For "unknown" devices, it might be worth printing the start of the title instead of "Unknown".

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Port scanner

Post by racingmini_mtl »

I'll think about that because that might be weird. But you can still hover your mouse over "Unknown" and get the complete firmware version assuming that the device responds to the usual commands.

And please let me know which devices you'd like to see added and ideally the pattern in the signature to identify the device (usually the first few characters in the signature remain constant).

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Port scanner

Post by jsmcortina »

Trans is the one that was Unknown here for me.

from sigs.c

Code: Select all

const char RevNum[SIZE_OF_REVNUM] =  {
  "Trans 00028.3      "
},
 Signature[SIZE_OF_SIGNATURE] = {
  "Trans controller pre-1.0 RC1 20150213 23:10GMT (c) JSM "
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Port scanner

Post by racingmini_mtl »

Give that one a try: http://www.jbperf.com/port_scanner/port ... _4_exe.zip. Simply replace your current exe with the one in the zip file.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Port scanner

Post by racingmini_mtl »

There is a new version that will make it easier for those using an IOx-based CAN device or a DIYAutotune CAN-EGT when they want to either change the CAN ID or update the firmware. The details are available on my forum: http://forum.jbperf.com/viewtopic.php?f=2&t=1282#p8356

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
Post Reply