Skip to content

VID/PID based device type detection #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 19, 2018

Conversation

bridadan
Copy link
Contributor

This builds on #369 to solve issue #165.

In PR #299 I added device type detection. It used a strategy that made use of the files present on the device to identify which firmware was most likely running on the interface chip. This was good enough to differentiate between JLink and DAPLink based firmwares, but got a little more complicated for firmwares like ST-Link. ST-Link tends to mimic DAPLink files quite closely, so this option isn't really feasible any more.

This PR switches the strategy to instead identify device types by the Vendor ID. In this case I'm not currently using the Product ID as it does not seem necessary at this point. There also is a small chance that the Product IDs may vary a bit depending on the release of the interface firmware, so I figured I'd postpone this change until we have evidence to the contrary.

Details to review (please 😄)

This also adds stlink to the list detectable firmwares. The STLink detection makes use of the DAPLink update logic at the moment, meaning you will see daplink_build and daplink_version in the JSON output, even though this is using stlink. I did this on purpose because this is how the information would have showed up in earlier versions. Should I also provide this info as stlink_*? Should I leave it how it is?

FYI @jupe @theotherjimmy

@coveralls
Copy link

coveralls commented Jul 17, 2018

Coverage Status

Coverage increased (+0.02%) to 80.462% when pulling b0aa4be on bridadan:firmware_detection into 281c44a on ARMmbed:master.

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with it as it is @jupe?

@@ -69,6 +69,12 @@ class MbedLsToolsBase(object):
DETAILS_TXT_NAME = 'DETAILS.TXT'
MBED_HTM_NAME = 'mbed.htm'

VENDOR_ID_DEVICE_TYPE_MAP = {
'0483': 'stlink',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rely on to these thtee VID in every boards now? what happens if VID does not match to some?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I believe we can, especially on anything released within the past few years. If the VID does not match it will default to the 'daplink' style detection (just like it used to).

@theotherjimmy theotherjimmy merged commit d76e4b1 into ARMmbed:master Jul 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants