Skip to content

Conversation

@mvolstad
Copy link

Proposed fix for: Serial number regex not allowing non-hex characters #41

@PrzemekWirkus
Copy link
Contributor

@mvolstad Please remove test part from your PR, it is breaking Ci.
Our CI is Linux based (so winreg module is not found) and have to find another way to unit test this function. I can see change is not so significant so we can merge it when you remove test part.

@mvolstad
Copy link
Author

@PrzemekWirkus Thanks, I have reverted the tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is illegal here. We are searching for target id which is specified as hex ascii string. For example:

usb-MBED_microcontroller_02400226489a1e6c000000000000000000000000b543e3d4-0:0 -> ../../sdb

has a valid 02400226489a1e6c000000000000000000000000b543e3d4 Target ID.

In your case ATML2127031800007973 is illegal (^ATML characters are illegal) target id. In any case, does your device have a mbed.htm file on MSD of interface chip?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note: four first characters define manufacturer_ids.
If you wish to detect correctly your devices, e.g. XPRO_SAM you have to make sure that your target id in USB ID starts with a proper substring, you XPRO case e.g. 0900 will be mapped to XPRO_SAMR21.
So any target id like '''0900deadcodedeadcodedeadcode``` will work!

@mvolstad
Copy link
Author

mvolstad commented Feb 1, 2016

Yes, we do have an mbed.htm file. This is an example of the redirect URL: http://mbed.org/device/?code=0900030841544d4c32313237303331383030303037393733d10b
Where 0900 is the manufacturer id, and 0308 refers to the version.

The problem is that the part after the version is expected to be the ASCII encoding of the USB serial number ("41544d4c32313237303331383030303037393733" = "ATML2127031800007973").

You're right that the USB mass storage class specifies the serial number to be hexadecimal. However, we haven't seen any practical limitations any other places than in mbed-ls. We would prefer to keep the serial number scheme we already have had in place before implementing MSC support. This pull request introduces a reasonable leniency.

@PrzemekWirkus
Copy link
Contributor

@mvolstad I did not forget about you :P I just had no time to look closer to it.
In theory we should always look at mbed.htm if USB ID is illegal. And yes, USB ID sometimes is used by manufacturers for different things, no need to bend it to mbed-ls.
Please be patient.

@mazimkhan
Copy link
Contributor

I see this change as minor leniency in detecting mbed devices since detection still largely based on vendor Id and mbed.htm. Hence merging!

@mazimkhan mazimkhan merged commit 198fcc4 into ARMmbed:master Oct 4, 2016
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.

3 participants