jcrona / rf-ctrl

A command-line tool to control 433MHz OOK based devices
GNU General Public License v2.0
41 stars 5 forks source link

Issue with the rf-ctrl and the somfy driver #2

Open Irdroid opened 7 years ago

Irdroid commented 7 years ago

When sending a command with a -n option to repeat the command transmit, the router halts / kerel panic's and a reboot is needed /tested on a Ralink RT5350 with 32MB RAM 8MB Flash and openwrt rf-ctrl gpio kernel driver /

rf-ctrl -p somfy -r 0xC0 -d 0x042420 -c on -n 16

jcrona commented 7 years ago

Could you please attach the kernel panic logs ?

Irdroid commented 7 years ago

Unfortunately the unit freezes without showing any syslog information and it reboots after a while .

The above happens also with repeat frames > 10 . Does it have something to do with priority (e.g the rf send applications get a greater priority for some reason)

jcrona commented 7 years ago

Maybe a watchdog that triggers a reboot. I suspect that the driver blocks the kernel for too long when it sends the frames. The ook-gpio driver uses udelay() and blocks the IRQs to achieve good timings. This was the fastest/dirty way to do it, but clearly not the best, even if it works well for my needs on the AR9331.

You could try to block and restore the IRQs at the beginning and end of each frame instead of the whole transmission, but it would not help for RAW protocols like Somfy. The best thing, I think, would be to implement the same behaviour using hrtimers, and see if it works. For that, you might first try to experiment with usleep_range() which is backed by hrtimers.

Irdroid commented 7 years ago

I have discovered that every command is send 10 times in code for the somfy driver. It works well if the command is sent just once, and the gpio kernel module is not blocking the kernel

jcrona commented 7 years ago

Glad to hear it ! However, the real somfy remote sends the command 10 times IIRC. So even if it works, the right approach would be to fix the kernel module.

I will probably do it at a point .