IOkit and Interrupts

Discussion in 'Mac Programming' started by MichaelDT, Feb 12, 2015.

  1. MichaelDT macrumors regular

    Aug 18, 2012
    So I've been playing around with my PC laptop and I'm trying to write a driver for an ACPI HID device (buttons). Anyways I get them to initialize, read state etc.. but I'm not receiving interrupt notifications. Of course this driver must act as it's own nub because it is in the ACPI plane. The interrupt specifiers and controllers native to the device show up in its IOService so I figured it would just be a matter of activating to receive them in my work loop? As a test my interruptOccurred method just outputs to IOLog....but hasn't been called as of yet.

    This is what I am doing:
        (start method)...........
    BTNDevice = OSDynamicCast(IOACPIPlatformDevice, provider);
        m_pWorkLoop = IOWorkLoop::workLoop();
        if(m_pWorkLoop == NULL)
            return false;
        IOLog("TabletButtons::Workloop started! \n");
        IOInterruptEventSource * interruptSource;
        interruptSource = IOInterruptEventSource::interruptEventSource( this,
                                                                       OSMemberFunctionCast(IOInterruptEventAction, this, &TabletButtons::interruptOccurred));;
        if (m_pWorkLoop->addEventSource(interruptSource) != kIOReturnSuccess)
            return false;
    .....(more start method)
    Here is a shot of the registry entry


    Any ideas what I'm doing wrong?
  2. subsonix macrumors 68040

    Feb 2, 2008
    Assuming everything went well up until you add the event source, I think you need to call interruptSource->enable() after it's added to the work loop.

Share This Page