Exemple #1
0
/* this function allows the subdriver to "claim" a device: return 1 if
 * the device is supported by this subdriver, else 0. */
static int tripplite_claim(HIDDevice_t *hd) {

	int status = is_usb_device_supported(tripplite_usb_device_table, hd);

	switch (status)
	{
	case POSSIBLY_SUPPORTED:

		switch (hd->VendorID)
		{
		case HP_VENDORID:
			/* by default, reject, unless the productid option is given */
			if (getval("productid")) {
				return 1;
			}

			/*
			 * this vendor makes lots of USB devices that are
			 * not a UPS, so don't use possibly_supported here
			 */
			return 0;

		case TRIPPLITE_VENDORID:
			/* reject known non-HID devices */
			/* not all Tripp Lite products are HID, some are "serial over USB". */
			if (hd->ProductID == 0x0001) {
				/* e.g. SMART550USB, SMART3000RM2U */
				upsdebugx(0, "This Tripp Lite device (%04x/%04x) is not supported by usbhid-ups.\n"
						 "Please use the tripplite_usb driver instead.\n",
						 hd->VendorID, hd->ProductID);
				return 0;
			}

			/* by default, reject, unless the productid option is given */
			if (getval("productid")) {
				return 1;
			}

			possibly_supported("TrippLite", hd);
			return 0;

		/* catch all (not really needed) */
		default:
			return 0;
		}

	case SUPPORTED:
		return 1;

	case NOT_SUPPORTED:
	default:
		return 0;
	}
}
Exemple #2
0
/* this function allows the subdriver to "claim" a device: return 1 if
 * the device is supported by this subdriver, else 0. */
static int openups_claim(HIDDevice_t * hd)
{
	int status = is_usb_device_supported(openups_usb_device_table, hd);

	switch (status) {
	case POSSIBLY_SUPPORTED:
		/* by default, reject, unless the productid option is given */
		if (getval("productid")) {
			return 1;
		}
		possibly_supported("openUPS", hd);
		return 0;

	case SUPPORTED:
		return 1;

	case NOT_SUPPORTED:
	default:
		return 0;
	}
}
Exemple #3
0
/* this function allows the subdriver to "claim" a device: return 1 if
 * the device is supported by this subdriver, else 0. */
static int liebert_claim(HIDDevice_t *hd) {

	int status = is_usb_device_supported(liebert_usb_device_table, hd->VendorID,
								 hd->ProductID);

	switch (status) {

		case POSSIBLY_SUPPORTED:
			/* by default, reject, unless the productid option is given */
			if (getval("productid")) {
				return 1;
			}
			possibly_supported("Liebert", hd);
			return 0;

		case SUPPORTED:
			return 1;

		case NOT_SUPPORTED:
		default:
			return 0;
	}
}