You are not logged in.
Pages: 1
Hi, I 've just created a custom initcpio hook for setserial and like to share it, because I haven't found so far any relative information on how to create a custom hook.
I 've written it because I have a fir (fast infrared) device which needs to be set serial first, otherwise the nsc-ircc module cannot be autoloaded via udev in early userspace. And TBH I like to avoid using rc.local. So:
$ cat /lib/initcpio/install/setserial
#!/bin/bash
build() {
SCRIPT="setserial"
add_binary /usr/bin/setserial
}
help() {
cat <<HELPEOF
This hook sets the serial property for the irda port
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:
I don't know if the last line is really necessary, because I used the udev hook as a guide. But since it is commented, It would probably make no difference.
$ cat /lib/initcpio/hooks/setserial
cat /lib/initcpio/hooks/setserial
run_hook ()
{
msg -n ":: Activating setserial for irda port"
setserial /dev/ttyS1 uart none
msg "done."
}
So far I tested the initcpio creation with the traditional gzip compression and it works, but haven't rebooted yet.
And for those who might be curious, these are the options for the nsc-ircc module in /etc/modprobe.d/nsc-ircc.conf
$ cat /etc/modprobe.d/nsc-ircc.conf
options nsc-ircc dongle_id=0x09 io=0x2f8 irq=3 dma=3
Proud Arch Linux user since 2007.
Offline
Reporting back, for those who might find this useful, it worked flawlessly. Proper port is setserial-ed, no errors during boot and nsc-ircc module loaded with no issues. Tested with irdadump. However, I haven't managed to get my fir working with LIRC.
Proud Arch Linux user since 2007.
Offline
rc.sysinit has hooks as well. Seems like a better place for it as this isnt really needed for early userspace.
Yes, I agree, but by doing so everytime initscripts are updated to include new information, I also have to re-edit it.
Proud Arch Linux user since 2007.
Offline
Pages: 1