i2c-ch341-usb icon indicating copy to clipboard operation
i2c-ch341-usb copied to clipboard

"make" fails

Open derandre24 opened this issue 3 years ago • 13 comments

Hello everyone,

when I try to compile the driver i get an error. It looks like there is maybe a problem with the kernel headers.

I did the following.

sudo apt-get update sudo apt-get upgrade sudo apt-get install dkms git clone https://github.com/gschorcht/i2c-ch341-usb.git cd i2c-ch341-usb make

thomas@searay:~/i2c-ch341-usb$ make make -C /lib/modules/5.13.0-22-generic/build M=/home/thomas/i2c-ch341-usb modules make[1]: Entering directory '/usr/src/linux-headers-5.13.0-22-generic' MODPOST /home/thomas/i2c-ch341-usb/Module.symvers ERROR: modpost: "irq_to_desc" [/home/thomas/i2c-ch341-usb/i2c-ch341-usb.ko] undefined! make[2]: *** [scripts/Makefile.modpost:150: /home/thomas/i2c-ch341-usb/Module.symvers] Error 1 make[2]: *** Deleting file '/home/thomas/i2c-ch341-usb/Module.symvers' make[1]: *** [Makefile:1794: modules] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.13.0-22-generic' make: *** [Makefile:20: i2c-ch341-usb.ko] Error 2

derandre24 avatar Dec 01 '21 13:12 derandre24

It's the same problem as mentioned in spi-ch341-usb#18.

E011011101001 avatar Jan 04 '22 16:01 E011011101001

I've the same problem, have you found a solution ?

EDIT: thanks to the message above, I've found the problem; but not the solution. The problem is that I can't use a recent kernel version with this driver because it uses "irq_to_desc". Can the owner make a new version of his driver for recent kernels please ?

antoninhrlt avatar Jan 05 '22 22:01 antoninhrlt

I am now using a Linux distribution with a 4.xx kernel.

derandre24 avatar Jan 06 '22 07:01 derandre24

I've the same problem, have you found a solution ?

@antoninhrlt I changed the kernel source irqdesc.c and exported the irq_to_desc manually as a workaround.

E011011101001 avatar Jan 07 '22 16:01 E011011101001

@antoninhrlt I changed the kernel source irqdesc.c and exported the irq_to_desc manually as a workaround.

Could you please show the changes? Thank you.

sujiwo avatar Jan 30 '22 13:01 sujiwo

I removed the macro wrapping this line and built the changed kernel. Now I boot that kernel whenever I need to use this driver.

(BTW, I don't know much about kernel development, so my workaround could cause some damages I don't understand.)

E011011101001 avatar Feb 02 '22 08:02 E011011101001

I got also the same error. Is there a simple step by step workarround?

henkiejan1 avatar Feb 12 '22 20:02 henkiejan1

What do you think about changing line 660 of i2c-ch341-usb.c to ch341_dev->irq_descs[i] = irq_data_to_desc( irq_get_irq_data(ch341_dev->irq_base + i) );

I think it should work...

xboxplayer9889 avatar Feb 27 '22 09:02 xboxplayer9889

What do you think about changing line 660 of i2c-ch341-usb.c to ch341_dev->irq_descs[i] = irq_data_to_desc( irq_get_irq_data(ch341_dev->irq_base + i) );

I think it should work...

I can confirm this solution works (Ubuntu 20.04, kernel 5.13.0, using MPU6050).

sujiwo avatar Mar 01 '22 03:03 sujiwo

What do you think about changing line 660 of i2c-ch341-usb.c to ch341_dev->irq_descs[i] = irq_data_to_desc( irq_get_irq_data(ch341_dev->irq_base + i) );

I think it should work...

Thank you so so so so much ! -> On Fedora Linux 5.16.5-200.fc35.x86_64

antoninhrlt avatar Mar 02 '22 18:03 antoninhrlt

I have tried xboxplayer9889's proposed fix and it seems indeed to work. Why isn't the issue closed then?

koalabi avatar May 28 '22 16:05 koalabi

I have tried xboxplayer9889's proposed fix and it seems indeed to work. Why isn't the issue closed then?

Yes i don't know why my pull request fixing this problem was not even merged/closed

It seems repository's owner does not look at his project often

antoninhrlt avatar May 28 '22 19:05 antoninhrlt

hmpf last change from gschorcht was on Oct 22, 2021

and now is Sep 2023

was forgotten by the repository owner

but change in line 660 in file i2c-ch341-usb.c works

easy to do :smile:

patch is:

diff --git a/i2c-ch341-usb.c b/i2c-ch341-usb.c
index a6ec111..74d2dec 100644
--- a/i2c-ch341-usb.c
+++ b/i2c-ch341-usb.c
@@ -657,7 +657,7 @@ static int ch341_irq_probe (struct ch341_device* ch341_dev)
 
     for (i = 0; i < ch341_dev->irq_num; i++)
     {
-        ch341_dev->irq_descs[i]   = irq_to_desc(ch341_dev->irq_base + i);
+        ch341_dev->irq_descs[i]   = irq_data_to_desc(irq_get_irq_data(ch341_dev->irq_base + i));
         ch341_dev->irq_enabled[i] = false;
 
         irq_set_chip          (ch341_dev->irq_base + i, &ch341_dev->irq);

BlackMage2 avatar Sep 10 '23 21:09 BlackMage2