示例#1
0
//******************************************************************************
/// \brief  Get number of debug messages available
/// \note   This may retrieve and buffer messages
/// \return #mxt_rc
int mxt_get_msg_count(struct mxt_device *mxt, int *count)
{
  int ret;

  switch (mxt->conn->type) {
  case E_SYSFS:
    if (sysfs_has_debug_v2(mxt))
      ret = sysfs_get_msgs_v2(mxt, count);
    else
      ret = dmesg_get_msgs(mxt, count, false);

    break;

#ifdef HAVE_LIBUSB
  case E_USB:
#endif /* HAVE_LIBUSB */
  case E_I2C_DEV:
  case E_HIDRAW:
    ret = t44_get_msg_count(mxt, count);
    break;

  default:
    mxt_err(mxt->ctx, "Device type not supported");
    ret = MXT_ERROR_NOT_SUPPORTED;
    break;
  }

  return ret;
}
示例#2
0
//******************************************************************************
/// \brief  Discard all messages
/// \return #mxt_rc
int t44_msg_reset(struct mxt_device *mxt)
{
  int count, i, ret, size;
  unsigned char databuf[20];

  ret = t44_get_msg_count(mxt, &count);
  if (ret)
  {
    mxt_verb(mxt->ctx, "rc = %d", ret);
    return ret;
  }

  for (i = 0; i < count; i++)
  {
    ret = t44_get_msg_bytes(mxt, &databuf[0], sizeof(databuf), &size);
    if (ret)
    {
      mxt_verb(mxt->ctx, "rc = %d", ret);
      return ret;
    }
  }

  return MXT_SUCCESS;
}