Пример #1
0
def cmd_test_hid(argv0, argv):
    """
	HID driver test. Displays gamepad inputs using hid driver.
	
	Usage: scc test-hid vendor_id device_id
	Return codes:
	  0 - normal exit
	  1 - invalid arguments or other error
	  2 - failed to open device
	  3 - device is not HID-compatibile
	  4 - failed to parse HID descriptor
	"""
    from scc.drivers.hiddrv import hiddrv_test, HIDController
    return hiddrv_test(HIDController, argv)
Пример #2
0
def cmd_test_hid(argv0, argv):
	"""
	HID driver test. Displays gamepad inputs using hid driver.
	
	Usage: scc test-hid vendor_id device_id
	Return codes:
	  0 - normal exit
	  1 - invalid arguments or other error
	  2 - failed to open device
	  3 - device is not HID-compatibile
	  4 - failed to parse HID descriptor
	"""
	from scc.drivers.hiddrv import hiddrv_test, HIDController
	return hiddrv_test(HIDController, argv)
Пример #3
0
            log.warning(
                "Failed to acquire USB device, falling back to evdev driver. This is far from optimal."
            )
            make_new_device(vid, pid, evdev_make_device_callback)
        else:
            log.error(
                "Failed to acquire USB device and evdev is not available. Everything is lost and DS4 support disabled."
            )
            # TODO: Maybe add_error here, but error reporting needs little rework so it's not threated as fatal
            # daemon.add_error("ds4", "No access to DS4 device")

    if config["drivers"].get("hiddrv") or (HAVE_EVDEV and
                                           config["drivers"].get("evdevdrv")):
        register_hotplug_device(hid_callback,
                                VENDOR_ID,
                                PRODUCT_ID,
                                on_failure=fail_cb)
        return True
    else:
        log.warning(
            "Neither HID nor Evdev driver is enabled, DS4 support cannot be enabled."
        )
        return False


if __name__ == "__main__":
    """ Called when executed as script """
    init_logging()
    set_logging_level(True, True)
    sys.exit(hiddrv_test(DS4Controller, ["054c:09cc"]))
Пример #4
0
		# 3rd, do a magic
		if controllerdevice and gyro and touchpad:
			return make_new_device(DS4EvdevController, controllerdevice, gyro, touchpad)
	
	
	def fail_cb(syspath, vid, pid):
		if HAVE_EVDEV:
			log.warning("Failed to acquire USB device, falling back to evdev driver. This is far from optimal.")
			make_evdev_device(syspath)
		else:
			log.error("Failed to acquire USB device and evdev is not available. Everything is lost and DS4 support disabled.")
			# TODO: Maybe add_error here, but error reporting needs little rework so it's not threated as fatal
			# daemon.add_error("ds4", "No access to DS4 device")
	
	if config["drivers"].get("hiddrv") or (HAVE_EVDEV and config["drivers"].get("evdevdrv")):
		register_hotplug_device(hid_callback, VENDOR_ID, PRODUCT_ID, on_failure=fail_cb)
		if HAVE_EVDEV and config["drivers"].get("evdevdrv"):
			daemon.get_device_monitor().add_callback("bluetooth",
							VENDOR_ID, PRODUCT_ID, make_evdev_device, None)
		return True
	else:
		log.warning("Neither HID nor Evdev driver is enabled, DS4 support cannot be enabled.")
		return False


if __name__ == "__main__":
	""" Called when executed as script """
	init_logging()
	set_logging_level(True, True)
	sys.exit(hiddrv_test(DS4Controller, [ "054c:09cc" ]))