groupgets / purethermal1-uvc-capture

USB Video Class capture examples for PureThermal 1 / PureThermal 2 FLIR Lepton Dev Kit
124 stars 81 forks source link

Command Word Generation #29

Closed sayezz closed 4 years ago

sayezz commented 4 years ago

Hi. I want to set and get parameters of a flir lepton 3.5 with a PureThermal Mini under Windows 10. Therefore I try to understand how setting and getting parameters works. Right now I'm using the PureThermal mediafoundation example under Windows 10 to get used to the implementation.

In File Device.cpp line 56-58 there is this: SetGetExtensionUnit(_xuLepOem, 9, KSPROPERTY_TYPE_GET, &version, sizeof(version)); SetGetExtensionUnit(_xuLepOem, 8, KSPROPERTY_TYPE_GET, flir_pn, sizeof(flir_pn)); SetGetExtensionUnit(_xuLepSys, 3, KSPROPERTY_TYPE_GET, flir_sn, sizeof(flir_sn));

As far as I have understood

I dont understand how the controlID is created. E.g for SetGetExtensionUnit(_xuLepSys, 3, KSPROPERTY_TYPE_GET, flir_sn, sizeof(flir_sn));

Why is it 3 and not 2? In the "Lepton™ Software Interface Description Document (IDD) OEM" there is the table 2 and table 3 saying:

Modules:
   -  0x100 AGC
   -  0x200 SYS
   -  0x300 VID
   -  ...

Command Types:
   - Get: 0x0
   - Set: 0x1
   - Run: 0x2
   - Invalid 0x3

The commannd ID is constructed like this: Module ID + Command ID Base + Type + Protection Bit value= Command ID with values: 0x0200 + 0x00 + 0x0 + 0x0000 = 0x0200

hex 0x0200 -> decimal: 2 But for a reason I can not understand the controlID is 3, ergo 0x0300. Can someone please tell me where my calculation error is. I appreciate.

sayezz commented 4 years ago

Okay, I think I got it. Just for the record if later on anyone else has the same problem. Please correct me if I'm wrong.

The value "3" in SetGetExtensionUnit(_xuLepSys, 3, KSPROPERTY_TYPE_GET, flir_sn, sizeof(flir_sn)); is not the command ID but the control ID. And the control IDs can be found here: purethermal1-uvc-capture/v4l2/uvcdynctrl/pt1.xml See Line 950:

<constant type="integer">
    <id>XU_LEP_CID_SYS_FLIR_SERIAL_NUMBER</id>
    <value>3</value>
</constant> 
<constant type="integer">
    <id>V4L2_LEP_CID_SYS_FLIR_SERIAL_NUMBER</id>
    <value>0x08030003</value>
</constant>
kekiefer commented 4 years ago

Thanks for posting the update to solve this!