Skip to content

Use the librarys in built SendKeyPress function #36

@sparky3387

Description

@sparky3387

Im trying to modify your library so it supports the inbuilt sendkeypress (and sendkeyrelease), but am having issues, here is what I have come up with so far (it appears to work, but nothing happens and it crashes with a stack smash):

static PyObject * Device_send_key_press(Device * self, PyObject * args) {
   unsigned char keycode;
   bool bWait;
   cec_user_control_code keypress;
   if( PyArg_ParseTuple(args, "bp:sendkeypress", &keycode,
         &bWait) ) {
      keypress = (cec_user_control_code) keycode;
      bool success;
      Py_BEGIN_ALLOW_THREADS
      cec_logical_address destination = self->addr;
      success = adapter->SendKeypress(destination, keypress, bWait);
      Py_END_ALLOW_THREADS
      if( success ) {
         Py_RETURN_TRUE;
      } else {
         Py_RETURN_FALSE;
      }
   } else {
      return NULL;
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions