# Enabling Lenovo Thinkpad T460p Webcam

## wfthirtyfour

Hi, all.

I am trying to enable webcam on Thinkpad T460p with this kernel:

```

$ uname -r

4.9.6-gentoo-r1

```

Camera showsup as the following

```

lsusb:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 001 Device 004: ID 5986:0708 Acer, Inc

Bus 001 Device 002: ID 138a:0090 Validity Sensors, Inc. 

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

```

```

dmesg:

[    2.185482] usb 1-8: New USB device found, idVendor=5986, idProduct=0708

[    2.186325] usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=0

[    2.187144] usb 1-8: Product: Integrated Camera

[    2.187954] usb 1-8: Manufacturer: SunplusIT Inc

```

I took two different approaches, both unsuccessfully.

First: following  that post, I attempted to enable camera through UVC, even though my device id is not listed on official site.

USB_F_UVC [=y]

USB_CONFIGFS_F_UVC [=y] 

USB_VIDEO_CLASS [=y]

Enabling these flags did nothing for me.

Than I resorted to GSPCA. One argument for is that they at least have sunplus module in kernel.

USB_GSPCA [=m]

USB_GSPCA_SUNPLUS [=m] 

I will also stress that VIDEO_V4L2 [=y] is on.

To the best of my knowledge, VIDEO_V4L2 is responsible for v4l2-core.

However, gspca_main cannot be loaded, with following error:

```

[ 1113.911770] gspca_main: Unknown symbol v4l2_ctrl_poll (err 0)

[ 1113.911775] gspca_main: Unknown symbol video_ioctl2 (err 0)

[ 1113.911776] gspca_main: Unknown symbol v4l2_get_timestamp (err 0)

[ 1113.911778] gspca_main: Unknown symbol v4l2_device_put (err 0)

[ 1113.911786] gspca_main: Unknown symbol v4l2_fh_open (err 0)

[ 1113.911789] gspca_main: Unknown symbol v4l2_ctrl_handler_setup (err 0)

[ 1113.911792] gspca_main: Unknown symbol video_devdata (err 0)

[ 1113.911795] gspca_main: Unknown symbol __v4l2_ctrl_s_ctrl (err 0)

[ 1113.911798] gspca_main: Unknown symbol v4l2_fh_release (err 0)

[ 1113.911800] gspca_main: Unknown symbol v4l2_ctrl_subscribe_event (err 0)

[ 1113.911802] gspca_main: Unknown symbol video_unregister_device (err 0)

[ 1113.911805] gspca_main: Unknown symbol v4l2_device_disconnect (err 0)

[ 1113.911808] gspca_main: Unknown symbol v4l2_device_register (err 0)

[ 1113.911810] gspca_main: Unknown symbol __video_register_device (err 0)

[ 1113.911811] gspca_main: Unknown symbol v4l2_ctrl_g_ctrl (err 0)

[ 1113.911813] gspca_main: Unknown symbol v4l2_ctrl_handler_free (err 0)

[ 1113.911814] gspca_main: Unknown symbol v4l2_device_unregister (err 0)

[ 1113.911815] gspca_main: Unknown symbol video_device_release_empty (err 0)

[ 1113.911817] gspca_main: Unknown symbol v4l2_event_unsubscribe (err 0)

[ 1135.613122] kworker/dying (1066) used greatest stack depth: 12600 bytes left

```

Indeed,

```
less /proc/kallsyms | grep v4l2

```

 is empty and it is a pure mystery to me why.

On top of that, grepping linux kernel sources with my device id also provides no ideas in which module I need to use for my camera.

I have put my full config here.

To sum up:

 Due to some reason I don't have v4l2

 Even if I remedy first problem, there is a thin hope that gspca_sunplus.ko will work for my cam

I have used Gentoo for more than 3 years now and it is first problem I could not solve on my own.  

Thank you for participation!)

----------

## Ant P.

You need to boot a kernel with V4L2. The one you're running doesn't have it.

----------

## wfthirtyfour

 *Ant P. wrote:*   

> You need to boot a kernel with V4L2. The one you're running doesn't have it.

 

I will doublecheck, but I doubt that it is so simple. My config has the option turned on. How can I not have it?

----------

## NeddySeagoon

wfthirtyfour,

You omitted 

```
mount /boot
```

so your kernel was silently installed to the wrong location, thats a common problem. 

What is the date/time in 

```
uname -a
```

That is the build date/time of the running kernel.  Is it what you expect?

Unknown symbol errors can indicate that your kernel and modules do not belong to the same kernel configuration.

That could happen if you did everything correctly but the mount /boot step.

----------

## wfthirtyfour

NeddySeagoon,

that was insightful suggestion.

However, I am still halfway to the understanding and bemused with what is happening on my device.

First, of course I have mounted boot properly. But, the current version of kernel is not what I expected.

```

wf34@wf34-tpad ~ $ uname -a

Linux wf34-tpad 4.9.6-gentoo-r1 #7 SMP Sun May 21 21:03:41 MSK 2017 x86_64 Intel(R) Core(TM) i5-6440HQ CPU @ 2.60GHz GenuineIntel GNU/Linux

```

```

wf34@wf34-tpad ~ $ l /boot/

total 22324

drwxr-xr-x  4 root root   16384 Jan  1  1970 .

drwxr-xr-x 22 root root    4096 Jan 31 22:40 ..

-rwxr-xr-x  1 root root  104044 Sep 24  2016 config-4.4.6-gentoo

-rwxr-xr-x  1 root root  115455 May 22 21:01 config-4.9.6-gentoo-r1

drwxr-xr-x  3 root root    8192 Jul 10  2016 EFI

drwxr-xr-x  6 root root    8192 May 22 21:06 grub

-rwxr-xr-x  1 root root       0 Feb  1 00:23 .keep

-rwxr-xr-x  1 root root 3526800 Sep 24  2016 System.map-4.4.6-gentoo

-rwxr-xr-x  1 root root 3810679 May 22 21:01 System.map-4.9.6-gentoo-r1

-rwxr-xr-x  1 root root 7274464 Sep 24  2016 vmlinuz-4.4.6-gentoo

-rwxr-xr-x  1 root root 7967280 May 22 21:01 vmlinuz-4.9.6-gentoo-r1

```

I don't even have any kernels dated May 21 now.

Where the hell did it load it from?

Is uname timestamp taken from kernel file creation date or is it something  else?

----------

## wfthirtyfour

NeddySeagoon,

update: the gspca_sunplus driver was what I needed for my device. The camera is working now.

----------

## Hu

 *wfthirtyfour wrote:*   

> Is uname timestamp taken from kernel file creation date or is it something  else?

 The kernel build captures the current time and includes it as text in the built kernel.  That text will never change, regardless of the mtime on the kernel or where you copy it.

----------

## wfthirtyfour

Hu, 

this timestamp would not change if I run another kernel build with unchanged config?

```

sudo make && sudo make modules_install && sudo make install

```

The timestamp which I get know with uname (older one, 21 May) suggests this behavior. However, I find it a bit counter-intuitive.

----------

## Hu

The timestamp will change if the object file in which it is stored is rebuilt.  That file will be rebuilt according to build system rules that I have not studied, so I cannot tell you the exact conditions under which it will or will not be updated.  If you have not changed the configuration, why would make (which should not need sudo) do anything?

----------

## NeddySeagoon

wfthirtyfour,

The rules for make examine the timestamps on the output files .o or .ko or whatever and compare them to

the timestamps on the input files that contribute to the output file.

When the output file is newer that all its input files, make does nothing for that output file as its already up to date.

Thus when you run make on an up to date kernel tree, make traverses the entire tree and finds nothing to do, so it does nothing.

If you really want to rebuild everything, you must run 

```
make clean
```

to remove all the output files first.

This behaviour also explains why make gets confused if your system time ever goes backwards.

When that happens, changed input files can appear to be older than the output file but make won't spot it.

It also allows you to change a single line in the kernel source code and make will only rebuild affected files.

Thats much better than rebuilding lots of things that have not changed.

----------

