You can ask
rsyslogd to run a program when it matches the line.
Create a file such as
/etc/rsyslog.d/my.conf with a line like
:msg, contains, "bad trackpad package" ^/bin/mytrackpadreset
and this will run the script
/bin/mytrackpadreset when the message is seen, passing the whole message as a single string argument. As the daemon runs as root, you can simply put the required
rmmod bcm5974 && modprobe bcm5974 command in the script, though you might need to set a suitable PATH first.
I think in the past
rsyslogd would wait for the script to end before continuing, but this no longer seems to be the case. If you expect to see the message many times in a burst, you may need some extra work in the script to cope with being run several times in parallel.
This legacy format (
^program) is superceded by the omprog module which is more useful for programs you want to start once, and run continuously, passing messages to it on stdin.