i2c-ch341-usb
i2c-ch341-usb copied to clipboard
"make" fails
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
It's the same problem as mentioned in spi-ch341-usb#18.
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 ?
I am now using a Linux distribution with a 4.xx kernel.
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.
@antoninhrlt I changed the kernel source
irqdesc.c
and exported theirq_to_desc
manually as a workaround.
Could you please show the changes? Thank you.
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.)
I got also the same error. Is there a simple step by step workarround?
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...
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).
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
I have tried xboxplayer9889's proposed fix and it seems indeed to work. Why isn't the issue closed then?
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
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);