pfps / yoga-laptop

Systems and information to make Lenovo Yoga laptops work better
GNU General Public License v3.0
156 stars 30 forks source link

Kernel 4.0 / Debian: make programs fails with "Undefined reference to `build_channel_array'" #39

Closed bagage closed 8 years ago

bagage commented 9 years ago

According to README, since I am running newer kernel than 3.16 I should only type make programs? When doing so, I am getting linking error:

$ make programs
cd sensors && make all
make[1]: Entering directory '/home/me/yoga-laptop/sensors'
cc generic_buffer.c  -o generic_buffer
/tmp/ccpVnbqv.o: dans la fonction « main »:
generic_buffer.c:(.text+0x139a): référence indéfinie vers « build_channel_array »
collect2: error: ld returned 1 exit status
Makefile:13: recipe for target 'generic_buffer' failed
make[1]: *** [generic_buffer] Error 1
make[1]: Leaving directory '/home/me/yoga-laptop/sensors'
Makefile:9: recipe for target 'programs' failed
make: *** [programs] Error 2
pfps commented 9 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256

Hmm. I'm not seeing that.

build_channel_array is defined in iio_utils.h as a inline function, so there should be no linking issue at all.

peter

On 05/17/2015 01:49 PM, Gautier Pelloux-Prayer wrote:

According to README, since I am running newer kernel than 3.16 I should only type |make programs|? When doing so, I am getting linking error:

$ make programs cd sensors && make all make[1]: Entering directory '/home/me/yoga-laptop/sensors' cc generic_buffer.c -o generic_buffer /tmp/ccpVnbqv.o: dans la fonction « main »: generic_buffer.c:(.text+0x139a): référence indéfinie vers « build_channel_array » collect2: error: ld returned 1 exit status Makefile:13: recipe for target 'generic_buffer' failed make[1]: [generic_buffer] Error 1 make[1]: Leaving directory '/home/me/yoga-laptop/sensors' Makefile:9: recipe for target 'programs' failed make: \ [programs] Error 2

— Reply to this email directly or view it on GitHub https://github.com/pfps/yoga-laptop/issues/39.

-----BEGIN PGP SIGNATURE----- Version: GnuPG v2

iQEcBAEBCAAGBQJVXUIvAAoJECjN6+QThfjzbOQIAL+jXL2D3ucQq2dgU1S5X9go DKRwoI9ficW2T8PENw2Y0snZaxYy6zuRSUxCT3+yi4eLO4jz78bw0bA3N3ZjIsKj 5IogfdA8gqGHTmVkPAZwYik81BSZeX53Nze1QP+n1/VPrKDA7AqimZP7+MJtYhRT sjIg/H2CrweomnGhvjLBS8zXvayF2OydSbPKLntz2zN6mAcV6OLL7mPy5CpSxiOL 5Kd3QAJYBNMw2Uo56NjAQuVVAz7ssM+uHTwsXQAZgN+GO8v53go+QUzfqyn4mYFn 3JxYCLmnXNOHV+QUHHvDlE6lTlbnTS7sg7R2MD9qL8ja/JKqZhoqPpll4JPBsj0= =KNFO -----END PGP SIGNATURE-----

bagage commented 9 years ago

Well, adding the following "patch" seems to fix the issue:

diff --git a/sensors/iio_utils.h b/sensors/iio_utils.h
index d6b7f07..ae0de51 100644
--- a/sensors/iio_utils.h
+++ b/sensors/iio_utils.h
@@ -22,6 +22,10 @@
 const char *iio_dir = "/sys/bus/iio/devices/";
 const char *iio_debugfs_dir = "/sys/kernel/debug/iio/";

+#ifndef inline
+#define inline
+#endif
+
 /**
  * iioutils_break_up_name() - extract generic name from full channel name
  * @full_name: the full channel name
diff --git a/sensors/libs/iio_utils.h b/sensors/libs/iio_utils.h
index eba9e2d..ce64a84 100644
--- a/sensors/libs/iio_utils.h
+++ b/sensors/libs/iio_utils.h
@@ -11,6 +11,7 @@
 #ifndef IIO_UTILS_H
 #define IIO_UTILS_H

+
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -28,6 +29,10 @@
 const char *iio_dir = "/sys/bus/iio/devices/";
 const char *iio_debugfs_dir = "/sys/kernel/debug/iio/";

+#ifndef inline
+#define inline
+#endif
+
 /**
  * iioutils_break_up_name() - extract generic name from full channel name
  * @full_name: the full channel name
rexcze-zz commented 9 years ago

Hello, I can confirm, that mentioned patch helped me to successfully ran make programs on Fedora 22 on Thinkpad Yoga 12.

davidcortesortuno commented 9 years ago

I have the same problem in Arch Linux Kernel 4.1.3, the patch solved the issue

g-goessel commented 9 years ago

Same for me. Using 4.1.6 on arch and the patch fixed it

bagage commented 8 years ago

Did someone actually managed to make orientation program work? Nothing happens here.

davidcortesortuno commented 8 years ago

I made it work for a Yoga 2 11'' laptop on Arch Linux

bagage commented 8 years ago

Did it required additional work? Basically running sudo ./orientation will produce:

iio device number being used is 5 iio trigger number being used is 5

And nothing more on kernel 4.2.0.1 Debian 4.2.1-1. Did you do anything special?

davidcortesortuno commented 8 years ago

Yes, I had to patch a kernel module, since for Yoga 2 laptops (11 or 13 inches) the kernel update to make the gyroscope to work is on the 4.3 version, and I am using 4.1.5

The kernel patch is here

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=21589ebda68172baeb03f35533ee2ec34543bf55

I also opened a thread some time ago

https://github.com/pfps/yoga-laptop/issues/37

bagage commented 8 years ago

Hmm, thanks for these explanations! I tried running kernel 4.3RC2 but Yoga 2 13" seems not supported - is that your second laptop? I should open a separate issue for that though.

davidcortesortuno commented 8 years ago

Sorry, I was confused. The guy who patched the kernel has a Yoga 3 14''

Do you have the same touchscreen and sensors? (Atmel, ITE) I thought the Yoga 2 11'' was similar to the 13''

bagage commented 8 years ago

No actually there are different, but #30 seems like exactly my issue. At least I know that it does not work on latest kernel version yet ;). lsusb output is:

Bus 001 Device 002: ID 8087:8000 Intel Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 006: ID 048d:8350 Integrated Technology Express, Inc. # Sensors Bus 002 Device 005: ID 0bda:b728 Realtek Semiconductor Corp. Bus 002 Device 004: ID 04f2:b40f Chicony Electronics Co., Ltd Bus 002 Device 003: ID 04f3:0303 Elan Microelectronics Corp. # Touchscreen Bus 002 Device 002: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

On kernel 4.2, I could see values changing in /sys/bus/iio/devices/iio:device3/in_rot_* (for name=dev_rotation) when rotating the screen but I am not sure what to do with that :).