aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/LowLevel/GenericHID
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Device/LowLevel/GenericHID')
-rw-r--r--Demos/Device/LowLevel/GenericHID/Config/AppConfig.h4
-rw-r--r--Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h4
-rw-r--r--Demos/Device/LowLevel/GenericHID/Descriptors.c6
-rw-r--r--Demos/Device/LowLevel/GenericHID/Descriptors.h4
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.c4
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.h4
-rw-r--r--Demos/Device/LowLevel/GenericHID/HostTestApp/test_generic_hid.py43
-rw-r--r--Demos/Device/LowLevel/GenericHID/makefile2
8 files changed, 33 insertions, 38 deletions
diff --git a/Demos/Device/LowLevel/GenericHID/Config/AppConfig.h b/Demos/Device/LowLevel/GenericHID/Config/AppConfig.h
index 636200ec6..62298d0f7 100644
--- a/Demos/Device/LowLevel/GenericHID/Config/AppConfig.h
+++ b/Demos/Device/LowLevel/GenericHID/Config/AppConfig.h
@@ -1,13 +1,13 @@
/*
LUFA Library
- Copyright (C) Dean Camera, 2017.
+ Copyright (C) Dean Camera, 2019.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
diff --git a/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h b/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h
index 00eefc7bf..ba1bbca92 100644
--- a/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h
+++ b/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h
@@ -1,13 +1,13 @@
/*
LUFA Library
- Copyright (C) Dean Camera, 2017.
+ Copyright (C) Dean Camera, 2019.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.c b/Demos/Device/LowLevel/GenericHID/Descriptors.c
index 2a248075a..f47a406c0 100644
--- a/Demos/Device/LowLevel/GenericHID/Descriptors.c
+++ b/Demos/Device/LowLevel/GenericHID/Descriptors.c
@@ -1,13 +1,13 @@
/*
LUFA Library
- Copyright (C) Dean Camera, 2017.
+ Copyright (C) Dean Camera, 2019.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
@@ -170,7 +170,7 @@ const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARR
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
-const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
+const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"LUFA Library");
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.h b/Demos/Device/LowLevel/GenericHID/Descriptors.h
index 30fc7e1ea..59e01be6f 100644
--- a/Demos/Device/LowLevel/GenericHID/Descriptors.h
+++ b/Demos/Device/LowLevel/GenericHID/Descriptors.h
@@ -1,13 +1,13 @@
/*
LUFA Library
- Copyright (C) Dean Camera, 2017.
+ Copyright (C) Dean Camera, 2019.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c
index 916457a2f..73856d0e0 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.c
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c
@@ -1,13 +1,13 @@
/*
LUFA Library
- Copyright (C) Dean Camera, 2017.
+ Copyright (C) Dean Camera, 2019.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h
index 4e6100c43..6810be1be 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.h
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h
@@ -1,13 +1,13 @@
/*
LUFA Library
- Copyright (C) Dean Camera, 2017.
+ Copyright (C) Dean Camera, 2019.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
diff --git a/Demos/Device/LowLevel/GenericHID/HostTestApp/test_generic_hid.py b/Demos/Device/LowLevel/GenericHID/HostTestApp/test_generic_hid.py
index 1e5f43019..7dc068dd5 100644
--- a/Demos/Device/LowLevel/GenericHID/HostTestApp/test_generic_hid.py
+++ b/Demos/Device/LowLevel/GenericHID/HostTestApp/test_generic_hid.py
@@ -1,6 +1,8 @@
+#!/usr/bin/env python
+
"""
LUFA Library
- Copyright (C) Dean Camera, 2017.
+ Copyright (C) Dean Camera, 2019.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
@@ -17,37 +19,34 @@
import sys
from time import sleep
-import pywinusb.hid as hid
-
-# Generic HID device VID, PID and report payload length (length is increased
-# by one to account for the Report ID byte that must be pre-pended)
-device_vid = 0x03EB
-device_pid = 0x204F
-report_length = 1 + 8
+import hid
def get_hid_device_handle():
- hid_device_filter = hid.HidDeviceFilter(vendor_id=device_vid,
- product_id=device_pid)
+ all_hid_devices = hid.enumerate()
- valid_hid_devices = hid_device_filter.get_devices()
+ lufa_hid_devices = [d for d in all_hid_devices if d['vendor_id'] == 0x03EB and d['product_id'] == 0x204F]
- if len(valid_hid_devices) is 0:
+ if len(lufa_hid_devices) is 0:
return None
- else:
- return valid_hid_devices[0]
+
+ device_handle = hid.device()
+ device_handle.open_path(lufa_hid_devices[0]['path'])
+ return device_handle
def send_led_pattern(device, led1, led2, led3, led4):
# Report data for the demo is the report ID (always zero) followed by the
# LED on/off data
- report_data = [0, led1, led2, led3, led4]
-
- # Zero-extend the array to the length the report should be
- report_data.extend([0] * (report_length - len(report_data)))
+ report_data = bytearray(9)
+ report_data[0] = 0
+ report_data[1] = led1
+ report_data[2] = led2
+ report_data[3] = led3
+ report_data[4] = led4
# Send the generated report to the device
- device.send_output_report(report_data)
+ device.write(report_data)
print("Sent LED Pattern: {0}".format(report_data[1:5]))
@@ -64,11 +63,7 @@ def main():
sys.exit(1)
try:
- hid_device.open()
-
- print("Connected to device 0x%04X/0x%04X - %s [%s]" %
- (hid_device.vendor_id, hid_device.product_id,
- hid_device.product_name, hid_device.vendor_name))
+ print("Connected to device.", flush=True)
# Set up the HID input report handler to receive reports
hid_device.set_raw_data_handler(received_led_pattern)
diff --git a/Demos/Device/LowLevel/GenericHID/makefile b/Demos/Device/LowLevel/GenericHID/makefile
index 7cd0aac47..5b423b744 100644
--- a/Demos/Device/LowLevel/GenericHID/makefile
+++ b/Demos/Device/LowLevel/GenericHID/makefile
@@ -1,6 +1,6 @@
#
# LUFA Library
-# Copyright (C) Dean Camera, 2017.
+# Copyright (C) Dean Camera, 2019.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org