Using GPIO for ir receiver and sysfs. Helpless noob.

Aug 14, 2019 - 3:38 AM

  • Connecting the 'data' pin of a TSOP38238 to pin 24 of the atomic's connector, then 'echo 335 /sys/class/gpio/export appears to populate sysfs with the appropriate junk. There is an 'edge' file which I 'echo both' to but 'modprobe gpio-ir-recv' doesn't see it to create /sys/class/media/rc/rcX. Been doing an awful lot of reading the last few weeks about gpio but I'm stumped. I just don't get using gpio. 'modinfo gpio-ir-recv' doesn't appear to allow any parms to assign. The ir receiver works as I have two that are swappable with the wife's raspberry. Please, for the love of all that is holy, point this jack-ass to the magic.
    Thanks

    0
  • I'm afraid sysfs won't help you here. In recent kernels, configuration seems to be done using device trees, so if you really have to use gpio-ir-recv, you'll need to go that route. It seems to involve adding a piece of code https://raw.githubusercontent.com/torvalds/linux/4cdd5f9186bbe80306e76f11da7ecb0b9720433c/Documentation/devicetree/bindings/media/gpio-ir-receiver.txt (with the GPIO reference adjusted to match your pin 335) to the device tree.

    Have you looked into lirc as an alternative?

    0
  • I was using sysfs as a way to expose the receiver to userspace. As far as I can tell, it's not discoverable. I would absolutely use lirc but I don't know what device to tell it to use. Research brings up kernel modules that don't seem to exist anymore that were configurable or would probe, for lirc AND the new ir-keytable. Is this forcing us to use the device tree? (Of which I've never heard)
    I could use any tips, pointers and recommendations.
    Thanks, Sergey.

    0
  • The closest conventional module I've found is https://github.com/pompompom/lirc-gpio but it's tranmsit only and doesn't build with Linux kernel 4.15+... will dig into device tree stuff.

    0
  • The one that should make this easy is gpioplug-ir-recv which I'm sure was a companion to gpio-ir-recv but it's not around anymore. Gpioplug-ir-recv took pin parms when loaded. I think that lirc-gpio used to also do receiving. Yes, that's gone.
    When I was doing searches, I was adding -raspberry to queries because the first several pages returned were about ir on the raspberry which were pretty much always solved by using an 'overlay' file to which one passes pin parms. That's what I did on my wife's raspberry to get her remote going and it was a piece of cake. I wonder if trying to see what that overlay file does will reveal some magic? I tried cat ing it a while ago but it's not in a readable format. Of course.
    Are you old enough to have used the real lirc? You could place a piece of broccoli on a heatsink and configure it for ir. Don't know why they had to go messing with it.
    I'll post back with discoveries, in case anyone's interested.
    Thanks, Sergey

    0