Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to update the CUPS daemon on my QNAP NAS, which runs a flavor of *nix. The entire OS system is loaded on a RAMDISK when the NAS boots so I've come up with a script that runs at start-up and injects my own coding. Now my problem is that I need to trigger the kernel action so that the usb printer driver calls the cupsd.sh script.

According to the manufacturer:

We modified the "USB Printer Device Class driver" of Linux kernel to issue a signal/message when plug-in/out a USB printer. After the daemon, picd get signal/message, it will call cupsd.sh to add_printer/del_printer .

Any ideas how I can accomplish this?

share|improve this question

1 Answer 1

Normally, it is done by udev in Linux, however I'm not sure if QNAP is using it. Another alternative is mdev from busybox. Check your system to see which approach it uses and then read corresponding documentation.

Generally the way it works is as follows:

  • kernel generates even when you plug new device,
  • a user space daemon (udev or mdev) listens for these events,
  • the event goes through a chain of rules and if match is found then corresponding action is taken,
  • the action can be to execute your custom script.
share|improve this answer
    
And how would I be able to check if udev or mdev is used? ... I can't find any of the binaries on the PATH. On a side note, I tried to unload the usbcore module and reinitialize it but with little success because it complains about missing module.dep ... Am I right to think that if I manage to reinitialize the usbcore module the system will think that a new device has been added and do it's normal routine? –  Chris19 Nov 22 '11 at 7:25
    
Try grep [um]dev /etc/init.d/*. I'm not very familiar with usbcore module, but in a grand scheme - this should be the module that provides events to udev/mdev. BTW, do you see any messages with dmesg when you add your device? If so, that means usbcore module is working and you only meed to figure out udev/mdev stuff. –  dtoubelis Nov 22 '11 at 15:36
    
I just got access to a qnap box and it seems that they do hot plugging it in a very custom way without using mdev. So, all I said before does not apply here. Sorry. –  dtoubelis Nov 22 '11 at 15:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.