Author Topic: Is bcdDevice v1.23 or v1.2.3?  (Read 41 times)

jb

  • Member
  • ***
  • Posts: 11
Is bcdDevice v1.23 or v1.2.3?
« on: September 06, 2018, 02:34:26 pm »
If bcdDevice is 0x0103

macOS System Report displays it as "Version: 1.03"

NirSoft USBDeview displays it as "1.03"

But I thought it was conceptually "1.0.3".

USB 3.2 spec says

Quote
The bcdUSB field contains a BCD version number. The value of the bcdUSB field is 0xJJMN for version JJ.M.N (JJ major version number, M minor version number, N sub-minor version number), e.g., version 2.1.3 is represented with value 0213H and version 3.0 is represented with a value of 0300H.

and Beyond Logic says

Quote
The value is in binary coded decimal with a format of 0xJJMN where JJ is the major version number, M is the minor version number and N is the sub minor version number.


Quote
The bcdDevice has the same format than the bcdUSB and is used to provide a device version number.
« Last Edit: September 06, 2018, 02:49:04 pm by jb »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2734
    • Lakeview Research
Re: Is bcdDevice v1.23 or v1.2.3?
« Reply #1 on: September 06, 2018, 02:38:07 pm »
The spec is the final authority. 1.0.3 is correct.

jb

  • Member
  • ***
  • Posts: 11
Re: Is bcdDevice v1.23 or v1.2.3?
« Reply #2 on: September 06, 2018, 02:45:59 pm »
Well the spec doesn't explicitly say "bcdDevice uses the same format as bcdUSB" that I can find.  It just says "binary-coded decimal".  Beyond Logic says they're the same format, but isn't official.

Also found XMOS document that says

Quote
BCD_DEVICE Description Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. ... Default: XMOS USB Audio Release version (e.g. 0x0651 for 6.5.1).
« Last Edit: September 07, 2018, 11:14:03 am by jb »

bpaddock

  • Member
  • ***
  • Posts: 36
Re: Is bcdDevice v1.23 or v1.2.3?
« Reply #3 on: September 07, 2018, 08:20:02 am »
The LUFA project uses this:

https://github.com/abcminiuser/lufa/blob/master/LUFA/Drivers/USB/Core/StdDescriptors.h

/** Macro to encode a given major/minor/revision version number into Binary Coded Decimal format for descriptor
          *  fields requiring BCD encoding, such as the USB version number in the standard device descriptor.
          *
          *  \note This value is automatically converted into Little Endian, suitable for direct use inside device
          *        descriptors on all architectures without endianness conversion macros.
          *
          *  \param[in]  Major     Major version number to encode.
          *  \param[in]  Minor     Minor version number to encode.
          *  \param[in]  Revision  Revision version number to encode.
          */
         #define VERSION_BCD(Major, Minor, Revision) \
                                                   CPU_TO_LE16( ((Major & 0xFF) << 8) | \
                                                                ((Minor & 0x0F) << 4) | \
                                                                (Revision & 0x0F) )


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2734
    • Lakeview Research
Re: Is bcdDevice v1.23 or v1.2.3?
« Reply #4 on: September 07, 2018, 03:25:39 pm »
Lacking any evidence to the contrary in the specs, I believe it is safe to assume that both "bcd" fields use the same format.