Giuliano69 / uvc_driver-for-Quanta-HD-User-Facing-0x0408-0x4035-

19 stars 9 forks source link

Compiling error with kernel 6.2.0-32-generic (ubuntu 22.04) #3

Open blasi-dave opened 1 year ago

blasi-dave commented 1 year ago

Hi, I'm trying to compile your module but I got this error:

:\~/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc# make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules make: Entering directory '/usr/src/linux-headers-6.2.0-32-generic' warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1\~22.04) 11.4.0 You are using: gcc-11 (Ubuntu 11.4.0-1ubuntu1\~22.04) 11.4.0 CC [M] /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.o /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c: In function ‘uvc_parse_format’: /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:254:39: error: ‘struct uvc_format’ has no member named ‘name’ 254 | strscpy(format->name, fmtdesc->name, | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:255:46: error: ‘struct uvc_format’ has no member named ‘name’ 255 | sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:260:40: error: ‘struct uvc_format’ has no member named ‘name’ 260 | snprintf(format->name, sizeof(format->name), "%pUl\n", | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:260:61: error: ‘struct uvc_format’ has no member named ‘name’ 260 | snprintf(format->name, sizeof(format->name), "%pUl\n", | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:273:47: error: ‘struct uvc_format’ has no member named ‘name’ 273 | strscpy(format->name, "Greyscale 8-bit (Y8 )", | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:274:54: error: ‘struct uvc_format’ has no member named ‘name’ 274 | sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:315:31: error: ‘struct uvc_format’ has no member named ‘name’ 315 | strscpy(format->name, "MJPEG", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:315:61: error: ‘struct uvc_format’ has no member named ‘name’ 315 | strscpy(format->name, "MJPEG", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:333:39: error: ‘struct uvc_format’ has no member named ‘name’ 333 | strscpy(format->name, "SD-DV", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:333:69: error: ‘struct uvc_format’ has no member named ‘name’ 333 | strscpy(format->name, "SD-DV", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:336:39: error: ‘struct uvc_format’ has no member named ‘name’ 336 | strscpy(format->name, "SDL-DV", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:336:70: error: ‘struct uvc_format’ has no member named ‘name’ 336 | strscpy(format->name, "SDL-DV", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:339:39: error: ‘struct uvc_format’ has no member named ‘name’ 339 | strscpy(format->name, "HD-DV", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:339:69: error: ‘struct uvc_format’ has no member named ‘name’ 339 | strscpy(format->name, "HD-DV", sizeof(format->name)); | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:349:31: error: ‘struct uvc_format’ has no member named ‘name’ 349 | strlcat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz", | ^~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:350:38: error: ‘struct uvc_format’ has no member named ‘name’ 350 | sizeof(format->name)); | ^~ In file included from ./include/linux/device.h:15, from ./include/linux/usb.h:19, from /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:15: /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:378:56: error: ‘struct uvc_format’ has no member named ‘name’ 378 | uvc_dbg(dev, DESCR, "Found format %s\n", format->name); | ^~ ./include/linux/dev_printk.h:129:48: note: in definition of macro ‘dev_printk’ 129 | _dev_printk(level, dev, fmt, ##__VA_ARGS__); \ | ^~~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:378:9: note: in expansion of macro ‘uvc_dbg’ 378 | uvc_dbg(dev, DESCR, "Found format %s\n", format->name); | ^~~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c: At top level: /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:2378:41: error: static declaration of ‘uvc_ctrl_power_line_mapping_limited’ follows non-static declaration 2378 | static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = { | ^~~~~~~~~~~ In file included from /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:25: /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvcvideo.h:731:41: note: previous declaration of ‘uvc_ctrl_power_line_mapping_limited’ with type ‘const struct uvc_control_mapping’ 731 | extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited; | ^~~~~~~~~~~ /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.c:2387:10: error: ‘const struct uvc_control_mapping’ has no member named ‘menu_count’ 2387 | .menu_count = ARRAY_SIZE(power_line_frequency_controls_limited), | ^~~~~~ make[1]: [scripts/Makefile.build:260: /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc/uvc_driver.o] Error 1 make: [Makefile:2026: /root/linux-hwe-6.2-6.2.0/drivers/media/usb/uvc] Error 2 make: Leaving directory '/usr/src/linux-headers-6.2.0-32-generic'

Can you help me to solve ?

Giuliano69 commented 1 year ago

which Ubuntu version are you using ? $ uname -a $ lsb_release -a

WagnerNasc commented 12 months ago

I'm also having problems and I'm a beginner, I'm trying to compile and generate the following message:

make: Entering directory '/usr/src/linux-headers-6.2.0-32-generic' warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 You are using: gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 scripts/Makefile.build:41: /lib/modules/6.2.0-32-generic/kernel/drivers/media/usb/uvc/Makefile: No such file or directory make[1]: No rule to make target '/lib/modules/6.2.0-32-generic/kernel/drivers/media/usb/uvc/Makefile'. Stop. make: [Makefile:2026: /lib/modules/6.2.0-32-generic/kernel/drivers/media/usb/uvc] Error 2 make: Leaving directory '/usr/src/linux-headers-6.2.0-32-generic'

Even with the problem, I tried restarting the computer and the change had no effect. Computer information:

$ uname -a

Linux ubuntu 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a

No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy

REASY commented 12 months ago

@Giuliano69 the same error happens to me, here is the output

user@ubuntu:/tmp$ uname -a
Linux ubuntu 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu:/tmp$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:    22.04
Codename:   jammy

As you can see, https://git.launchpad.net/ubuntu/+source/linux-hwe-6.2/tree/drivers/media/usb/uvc/uvcvideo.h#n258 does not have name field.

If I download https://packages.ubuntu.com/jammy/linux-hwe-6.2-headers-6.2.0-32, http://archive.ubuntu.com/ubuntu/pool/main/l/linux-hwe-6.2/linux-hwe-6.2_6.2.0.orig.tar.gz, then inside at linux-6.2\drivers\media\usb\uvc\ I can see uvcvideo.h has name fiield

struct uvc_format {
    u8 type;
    u8 index;
    u8 bpp;
    enum v4l2_colorspace colorspace;
    enum v4l2_xfer_func xfer_func;
    enum v4l2_ycbcr_encoding ycbcr_enc;
    u32 fcc;
    u32 flags;

    char name[32];

    unsigned int nframes;
    struct uvc_frame *frame;
};

This is my updated version of your compile_module.sh script

#!/bin/bash 

#Test linux distribution and version
source /etc/os-release
if [ "$ID" != "ubuntu" ]; then 
    echo "Sorry, this script works only for Ubuntu distribution"
    exit
fi

if [ "$VERSION_ID" != "22.04" ]; then 
    echo "Sorry, this script works only for Ubuntu 22.04 LTS"
    exit
fi

sudo apt update # update package list
sudo apt upgrade # upgrade packages
sudo apt install build-essential -y # install tools needed for module compilation

#get driver code to compile a patch it
cd ~  # change to your home directory

wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux-hwe-6.2/linux-hwe-6.2_6.2.0.orig.tar.gz && \
    tar -xzf linux-hwe-6.2_6.2.0.orig.tar.gz
cd ~/linux-*/drivers/media/usb/uvc # change to the currently created uvc directory
mv uvc_driver.c uvc_driver.old  # rename/backup the uvc driver soruce file, that need to be updated
wget https://raw.githubusercontent.com/Giuliano69/uvc_driver-for-Quanta-HD-User-Facing-0x0408-0x4035-/main/uvc_driver.c # download the updated driver source file

#compile and install
make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules  # complie the updated video modules for your kernel version
sudo cp uvcvideo.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/  #install the video driver module in the system
sudo rmmod uvcvideo && sudo modprobe uvcvideo
#reboot  #reboot to check your camera is working
romainwg commented 10 months ago

@Giuliano69 the same error happens to me, here is the output

user@ubuntu:/tmp$ uname -a
Linux ubuntu 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu:/tmp$ lsb_release -a
No LSB modules are available.
Distributor ID:   Ubuntu
Description:  Ubuntu 22.04.3 LTS
Release:  22.04
Codename: jammy

As you can see, https://git.launchpad.net/ubuntu/+source/linux-hwe-6.2/tree/drivers/media/usb/uvc/uvcvideo.h#n258 does not have name field.

If I download https://packages.ubuntu.com/jammy/linux-hwe-6.2-headers-6.2.0-32, http://archive.ubuntu.com/ubuntu/pool/main/l/linux-hwe-6.2/linux-hwe-6.2_6.2.0.orig.tar.gz, then inside at linux-6.2\drivers\media\usb\uvc\ I can see uvcvideo.h has name fiield

struct uvc_format {
  u8 type;
  u8 index;
  u8 bpp;
  enum v4l2_colorspace colorspace;
  enum v4l2_xfer_func xfer_func;
  enum v4l2_ycbcr_encoding ycbcr_enc;
  u32 fcc;
  u32 flags;

  char name[32];

  unsigned int nframes;
  struct uvc_frame *frame;
};

This is my updated version of your compile_module.sh script

#!/bin/bash 

#Test linux distribution and version
source /etc/os-release
if [ "$ID" != "ubuntu" ]; then 
  echo "Sorry, this script works only for Ubuntu distribution"
  exit
fi

if [ "$VERSION_ID" != "22.04" ]; then 
  echo "Sorry, this script works only for Ubuntu 22.04 LTS"
  exit
fi

sudo apt update # update package list
sudo apt upgrade # upgrade packages
sudo apt install build-essential -y # install tools needed for module compilation

#get driver code to compile a patch it
cd ~  # change to your home directory

wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux-hwe-6.2/linux-hwe-6.2_6.2.0.orig.tar.gz && \
  tar -xzf linux-hwe-6.2_6.2.0.orig.tar.gz
cd ~/linux-*/drivers/media/usb/uvc # change to the currently created uvc directory
mv uvc_driver.c uvc_driver.old  # rename/backup the uvc driver soruce file, that need to be updated
wget https://raw.githubusercontent.com/Giuliano69/uvc_driver-for-Quanta-HD-User-Facing-0x0408-0x4035-/main/uvc_driver.c # download the updated driver source file

#compile and install
make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules  # complie the updated video modules for your kernel version
sudo cp uvcvideo.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/  #install the video driver module in the system
sudo rmmod uvcvideo && sudo modprobe uvcvideo
#reboot  #reboot to check your camera is working

Thank you ! :+1:

For information, it works for me on the following configuration:

Acer / Nitro AN515-58

lsusb
# ID 0408:4035 Quanta Computer, Inc. ACER HD User Facing
lsb_release -a
# No LSB modules are available.
# Distributor ID:   Ubuntu
# Description:  Linux Lite 6.4
# Release:  22.04
# Codename: jammy
uname -a
# Linux 6.2.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct  6 10:23:26 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
fus0g commented 6 months ago

Created a New repo https://github.com/PrabhatProxy/Quanta-HD-User-Facing-0x0408-0x4035_linux and added it as a systemd service and it works.