驱动程序中的 FIDL

设备可以实现 ddk::Messagable mixin,以便在客户端尝试连接到驱动程序时由 devfs 发送消息。驱动程序必须使用它想要说出的特定 FIDL 接口实现 ddk::Messagable

例如,实现 fuchsia_input_report::InputDevice 接口的驱动程序可能具有如下类定义:

class InputReportDriver;
using DriverDeviceType = ddk::Device<InputReportDriver, ddk::Unbindable,
                                     ddk::Messageable<fuchsia_input_report::InputDevice>::Mixin>;
class InputReportDriver : public DriverDeviceType{
    // Implement the class methods here.
};

希望与此设备通信的客户端会在 /dev/class/input-report/ 中打开相关的设备文件,并开始发送 FIDL 消息。