The current example of the irSensor always fails if the controller is still attached to the Switch.
The method irsGetIrCameraHandle expects the official id (0x20) for the handheld mode but currently the CONTROLLER_HANDHELD property is equal to 0x08.
Applying the method 'hidControllerIDToOfficial' to the 'CONTROLLER_HANDHELD' property converts it to the correct value and the sample will work as expected.
I'm not exactly sure if this is an issue with the irSensor sample or that the CONTROLLER_HANDHELD property should be mapped to 0x20 in order for it to be used as-is.
The current example of the irSensor always fails if the controller is still attached to the Switch. The method irsGetIrCameraHandle expects the official id (0x20) for the handheld mode but currently the CONTROLLER_HANDHELD property is equal to 0x08. Applying the method 'hidControllerIDToOfficial' to the 'CONTROLLER_HANDHELD' property converts it to the correct value and the sample will work as expected.
Line 69 (https://github.com/switchbrew/switch-examples/blob/master/hid/irsensor/source/main.c#L69) should be like : rc = irsGetIrCameraHandle(&irhandle, hidGetHandheldMode() ? hidControllerIDToOfficial(CONTROLLER_HANDHELD) : CONTROLLER_PLAYER_1);
I'm not exactly sure if this is an issue with the irSensor sample or that the CONTROLLER_HANDHELD property should be mapped to 0x20 in order for it to be used as-is.