switchbrew / switch-examples

Switch examples for devkitA64 and libnx.

Home Page:https://devkitpro.org/viewforum.php?f=42

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

irSensor : example works in handheld mode if hidControllerIDToOfficial is applied

basvijfwinkel opened this issue · comments

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.

Already fixed in latest libnx 2.3.0 release.