johannesthoma / linux-hc-sro4

The HC-SRO4 is an ultrasonic distance sensor to be attached on 2 5V GPIO pins. This driver uses the interrupt logic of the GPIO driver to measure the distance in a non-blocking, precise and load-independend way. Unlike user land measurement methods you can even compile a linux kernel while doing measurements without getting weird results.
GNU General Public License v2.0
26 stars 17 forks source link

Replaced class_attrs with class_groups for kernel 4.14 #2

Closed adasek closed 8 months ago

adasek commented 6 years ago

Hi, I encourted an error "_unknown field ‘classattrs’ specified in initializer" during compilation on Raspbian with kernel 4.14.20-v7+ (according to https://www.raspberrypi.org/forums/viewtopic.php?t=205802 I am not alone)

It seemed that _classattrs got deprecated in newer kernel version. I used patch from some other project and did analogical changes to hc-sro4 driver. It got compiled and seems to work on my platform. Could you test it on older version?

johannesthoma commented 6 years ago

Hi, thanks a lot for your patch.

It would, however break compatibility with older kernels.

Please note that meanwhile, newer kernels contain a proper IIO driver for the HC-SR04: see /drivers/iio/proximity/srf04.c I haven't tried it with the hardware (I don't have the hardware any more), but reading from the source I would assume that it is compatible with the HC-SR04.

If you have the hardware, you can try this driver from mainline and please let me know the results, so I can update the documentation.

Thanks a lot,