Writing a combination device/protocol module

If you're writing a driver for a custom type of device where it doesn't make sense to split up the functionality of device and protocol, you can write a combination module.

To do this, you simply proceed as you would when writing a "normal" driver: fill in your callbacks, talk to your device, interpret its protocol, etc.

In addition, there are two things you have to do:

  1. In the type field, put in DEVI_MODULE_TYPE_DEVICE | DEVI_MODULE_TYPE_PROTO in addition to the DEVI_CLASS_ manifest.
  2. When you've interpreted the data from your device, package up a struct packet_* (depending on your class of device) and send it up.