Ejemplo n.º 1
0
//******************************************************************************
/// \brief  Close device
void mxt_free_device(struct mxt_device *mxt)
{
  switch (mxt->conn->type) {
  case E_SYSFS:
    sysfs_release(mxt);
    break;

  case E_I2C_DEV:
    i2c_dev_release(mxt);
    break;

#ifdef HAVE_LIBUSB
  case E_USB:
    usb_release(mxt);
    break;
#endif /* HAVE_LIBUSB */

  case E_HIDRAW:
    hidraw_release(mxt);
    break;

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


  mxt->conn = mxt_unref_conn(mxt->conn);

  free(mxt->info.raw_info);
  free(mxt->report_id_map);
  free(mxt);
}
Ejemplo n.º 2
0
EM2874Device::~EM2874Device ()
{
	if(fd >= 0)
	{
		writeReg(EM2874_REG_TS_ENABLE, 0);
		writeReg(EM28XX_REG_GPIO, 0xFF);
		writeReg(EM2874_REG_CAS_MODE1, 0x0);
		writeReg(0x0C, 0x0);
		usb_release(fd, 0);
		close(fd);
	}
}
Ejemplo n.º 3
0
static int command_usb(int argc, char **argv)
{
	if (argc > 1) {
		if (!strcasecmp("on", argv[1]))
			usb_init();
		else if (!strcasecmp("off", argv[1]))
			usb_release();
		else if (!strcasecmp("a", argv[1]))
			select_phy(USB_SEL_PHY0);
		else if (!strcasecmp("b", argv[1]))
			select_phy(USB_SEL_PHY1);
	}

	showregs();
	ccprintf("PHY %c\n", (which_phy == USB_SEL_PHY0 ? 'A' : 'B'));

	return EC_SUCCESS;
}
Ejemplo n.º 4
0
static int command_usb(int argc, char **argv)
{
	int val;

	if (argc > 1) {
		if (!strcasecmp("a", argv[1]))
			usb_select_phy(USB_SEL_PHY0);
		else if (!strcasecmp("b", argv[1]))
			usb_select_phy(USB_SEL_PHY1);
		else if (parse_bool(argv[1], &val)) {
			if (val)
				usb_init();
			else
				usb_release();
		} else
			return EC_ERROR_PARAM1;
	}

	showregs();
	ccprintf("PHY %c\n", (which_phy == USB_SEL_PHY0 ? 'A' : 'B'));

	return EC_SUCCESS;
}