第3期项目实战课程里视频监控那块,myuvc编译一直报错(用官网上下载的代码,没有进行修改),是因为老师的makefile里用的linux-headers-2.6.31-14-generic头文件,而我用的linux-headers-4.18.0-15-generic头文件吗
make -C /usr/src/linux-headers-4.18.0-15-generic M=pwd
modules
make[1]: Entering directory ‘/usr/src/linux-headers-4.18.0-15-generic’
CC [M] /home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.o
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c: In function ‘myuvc_get_streaming_params’:
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:394:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ret < 0)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:397:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
ctrl->bmHint = le16_to_cpup((__le16 *)&data[0]);
^~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c: In function ‘myuvc_uninit_urbs’:
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:542:13: error: implicit declaration of function ‘usb_buffer_free’; did you mean ‘usb_buffer_map_sg’? [-Werror=implicit-function-declaration]
usb_buffer_free(myuvc_udev, myuvc_queue.urb_size, myuvc_queue.urb_buffer[i], myuvc_queue.urb_dma[i]);
^~~~~~~~~~~~~~~
usb_buffer_map_sg
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c: In function ‘myuvc_video_complete’:
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:565:13: warning: unused variable ‘wake_cnt’ [-Wunused-variable]
static int wake_cnt = 0;
^~~~~~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c: In function ‘myuvc_alloc_init_urbs’:
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:794:37: error: implicit declaration of function ‘usb_buffer_alloc’; did you mean ‘usb_buffer_map_sg’? [-Werror=implicit-function-declaration]
myuvc_queue.urb_buffer[i] = usb_buffer_alloc(
^~~~~~~~~~~~~~~~
usb_buffer_map_sg
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:794:35: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
myuvc_queue.urb_buffer[i] = usb_buffer_alloc(
^
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c: In function ‘myuvc_vidioc_queryctrl’:
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1028:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ctrl->id != V4L2_CID_BRIGHTNESS)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1031:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
memset(ctrl, 0, sizeof ctrl);
^~~~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1043:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ret != 2)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1045:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
ctrl->minimum = myuvc_get_le_value(data); / Note signedness /
^~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1050:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ret != 2)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1052:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
ctrl->maximum = myuvc_get_le_value(data); / Note signedness /
^~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1056:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ret != 2)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1058:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
ctrl->step = myuvc_get_le_value(data); / Note signedness /
^~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1062:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ret != 2)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1064:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
ctrl->default_value = myuvc_get_le_value(data); / Note signedness /
^~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c: In function ‘myuvc_vidioc_g_ctrl’:
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1080:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ctrl->id != V4L2_CID_BRIGHTNESS)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1083:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
pipe = usb_rcvctrlpipe(myuvc_udev, 0);
^~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1088:5: warning: this ‘if’ clause does not guard… [-Wmisleading-indentation]
if (ret != 2)
^~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1090:2: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
ctrl->value = myuvc_get_le_value(data); / Note signedness /
^~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c: At top level:
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1269:6: error: ‘const struct v4l2_file_operations’ has no member named ‘ioctl’
.ioctl = video_ioctl2, / V4L2 ioctl handler /
^~~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1269:19: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.ioctl = video_ioctl2, / V4L2 ioctl handler */
^~~~~~~~~~~~
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:1269:19: note: (near initialization for ‘myuvc_fops.open’)
/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.c:565:13: warning: ‘wake_cnt’ defined but not used [-Wunused-variable]
static int wake_cnt = 0;
^~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:332: recipe for target ‘/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.o’ failed
make[2]: *** [/home/book/JZ2440/kernel/linux-3.4.2/myuvc/myuvc.o] Error 1
Makefile:1534: recipe for target ‘module/home/book/JZ2440/kernel/linux-3.4.2/myuvc’ failed
make[1]: *** [module/home/book/JZ2440/kernel/linux-3.4.2/myuvc] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.18.0-15-generic’
Makefile:4: recipe for target ‘all’ failed
make: *** [all] Error 2