//****************************************************************************** /// \brief Get T5 message as byte array /// \param mxt Maxtouch Device /// \param buf Pointer to buffer /// \param buflen Length of buffer /// \param count length of message in bytes /// \return #mxt_rc int mxt_get_msg_bytes(struct mxt_device *mxt, unsigned char *buf, size_t buflen, int *count) { int ret; switch (mxt->conn->type) { case E_SYSFS: if (sysfs_has_debug_v2(mxt)) ret = sysfs_get_msg_bytes_v2(mxt, buf, buflen, count); else ret = dmesg_get_msg_bytes(mxt, buf, buflen, count); break; #ifdef HAVE_LIBUSB case E_USB: #endif /* HAVE_LIBUSB */ case E_I2C_DEV: case E_HIDRAW: ret = t44_get_msg_bytes(mxt, buf, buflen, count); break; default: mxt_err(mxt->ctx, "Device type not supported"); ret = MXT_ERROR_NOT_SUPPORTED; break; } if (ret == MXT_SUCCESS) mxt_log_buffer(mxt->ctx, LOG_DEBUG, MSG_PREFIX, buf, *count); return ret; }
//****************************************************************************** /// \brief Get debug message string /// \param mxt Device context /// \return C string or NULL char *sysfs_get_msg_string_v2(struct mxt_device *mxt) { int ret, i; int size; size_t length; unsigned char databuf[20]; static char msg_string[255]; ret = sysfs_get_msg_bytes_v2(mxt, &databuf[0], sizeof(databuf), &size); if (ret) return NULL; length = snprintf(msg_string, sizeof(msg_string), "MXT MSG:"); for (i = 0; i < size; i++) { length += snprintf(msg_string + length, sizeof(msg_string) - length, "%02X ", databuf[i]); } return &msg_string[0]; }