[linux-uvc-devel] How do I properly expose control unit to toggle camera's infrared emitter
Linux UVC driver and tools
Brought to you by:
pinchartl
From: Peter-Simon D. <pet...@po...> - 2019-11-02 19:06:31
|
Hi, I recently bought a Lenovo T490s with an integrated IR-camera that is compatible with Windows Hello face authentication. The camera shows up as: 04f2:b67c Chicony Electronics Co., Ltd Integrated Camera The camera has an integrated IR emitter which is off by default. By looking at Wireshark USB dumps while an app in Windows turned on the LED, I found a call to the Realtek Extended Control Unit 26b8105a-0713-4870-979d-da79444bb68e (to which I couldn't find any documentation), writing 2 bytes to the selector 0x0e. The data sent was 0x0219 and would indeed turn on the IR LED. The first byte (0x19) seems to control the intensity (0x19 is seemingly already the maximum intensity). I don't know what the second byte does: 0x01 seems to do the same, 0x00 turns off the LED. I wrote a simple tool that can send the corresponding UVCIOC_CTRL_QUERY to the device (https://github.com/PetePriority/chicony-ir-toggle/), however, this feels more of a workaround to me. One could use udev rules to do this at boot. However, another call is necessary after waking from suspend. I don't know if this is possible with udev. I tried mapping this control with UVCIOC_CTRL_MAP, (UVC_CTRL_DATA_TYPE_UNSIGNED -> V4L2_CTRL_TYPE_INTEGER) but the control reports a range from 0 to 2 and only sets the the second byte. I don't know how I would go about exposing the raw bytes to v4l2. I'm writing to this list because * I thought someone might find these findings interesting/useful, * I'm unsure of what would be the right way to expose the functionality of enabling the IR emitters (I haven't done anything regarding uvcvideo or v4l2 before)? Would turning on the LED be the responsibility of the user applications by calling the ioctl directly? Should this go into the uvcvideo driver or the v4l2 layer? Thanks! Peter |