原文:
[RK3399][Android7.1] 调试笔记 --- 设置Camera的facing属性_KrisFei的博客-CSDN博客
这是rk的改法,换到905一看,插OTG和插HOST都是usb1,死球。硬件说OTG是直出的,但是为啥都是挂到usb1下面呢。所以给的补丁失灵,以上改法也失灵。
遂自研一个补丁。如下
diff --git a/common/drivers/media/usb/uvc/uvc_v4l2.c b/common/drivers/media/usb/uvc/uvc_v4l2.c
index 05eed4b..eb0792b 100644
--- a/common/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/common/drivers/media/usb/uvc/uvc_v4l2.c
@@ -30,6 +30,8 @@
#include "uvcvideo.h"
+#include <linux/input.h>
+
/* ------------------------------------------------------------------------
* UVC ioctls
*/
@@ -567,10 +569,23 @@ static int uvc_ioctl_querycap(struct file *file, void *fh,
struct uvc_fh *handle = file->private_data;
struct uvc_video_chain *chain = handle->chain;
struct uvc_streaming *stream = handle->stream;
-
+ const char *path;
+ struct input_dev *inoo_dev;
strlcpy(cap->driver, "uvcvideo", sizeof(cap->driver));
strlcpy(cap->card, vdev->name, sizeof(cap->card));
+
+ //luke add for fix camera front for some client
+ //uvc_streaming->uvc_device->input_dev
+ inoo_dev = stream->dev->input;
+ path = kobject_get_path(&inoo_dev->dev.kobj, GFP_KERNEL);
+ //printk("input pathhhhluke is %s\n", path);
+ //经观察 /devices/platform/ff500000.dwc3/xhci-hcd.0.auto/usb1/1-1/1-1.2/1-1.2:1.0/ 1-2就是OTG。把它当前置就行了
+ if( strstr(path, "1-2") != NULL)
+ strcpy(cap->card, "front");
+ //end add
+
usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));
+ //printk("sssk %s\n", cap->bus_info);
cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
| chain->caps;
if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
不行也别问我。搞amlogic平台的同学应该要有自己追踪并解决问题的能力。
从java层追hal层,一步步打印去。
比如这个EmulatedCamera3.cpp....
hardware/amlogic/camera/CameraHal_Module.cpp 我发现他没有调用到。。