From 30336afc49686c734155dfcc2baf4ba7cda80ec0 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Tue, 2 Jul 2024 17:18:37 -0400 Subject: [PATCH 1/2] Use pid.codes VID/PIDs --- contrib/54-luna-plugdev.rules | 8 ++++++-- contrib/54-luna-uaccess.rules | 7 +++++-- examples/usb/acm_serial.py | 4 ++-- examples/usb/counter_device.py | 6 +++--- examples/usb/interrupt_device.py | 6 +++--- examples/usb/isochronous_count.py | 6 +++--- examples/usb/loopback.py | 6 +++--- examples/usb/simple_device.py | 6 +++--- examples/usb/stream_out_device.py | 6 +++--- examples/usb/stress_test_device.py | 6 +++--- examples/usb/superspeed/simple_device.py | 6 +++--- examples/usb/superspeed/stream_in_device.py | 6 +++--- examples/usb/superspeed/vendor_request.py | 6 +++--- examples/usb/vendor_request.py | 6 +++--- luna/gateware/applets/speed_test.py | 14 ++++++++++---- luna/gateware/usb/devices/ila.py | 8 ++++---- tests/test_usb2_device.py | 8 ++++---- 17 files changed, 64 insertions(+), 51 deletions(-) diff --git a/contrib/54-luna-plugdev.rules b/contrib/54-luna-plugdev.rules index 186d05a15..2c4f72bce 100644 --- a/contrib/54-luna-plugdev.rules +++ b/contrib/54-luna-plugdev.rules @@ -1,4 +1,8 @@ -ATTR{idVendor}=="16d0", ATTR{idProduct}=="05a5", SYMLINK+="luna%k", MODE="660", GROUP="plugdev" -ATTR{idVendor}=="16d0", ATTR{idProduct}=="0f3b", SYMLINK+="lunatarget%k", MODE="660", GROUP="plugdev" +ATTR{idVendor}=="1209", ATTR{idProduct}=="0001", SYMLINK+="luna-test1-%k", MODE="660", GROUP="plugdev" +ATTR{idVendor}=="1209", ATTR{idProduct}=="0002", SYMLINK+="luna-test2-%k", MODE="660", GROUP="plugdev" +ATTR{idVendor}=="1209", ATTR{idProduct}=="0003", SYMLINK+="luna-test3-%k", MODE="660", GROUP="plugdev" +ATTR{idVendor}=="1209", ATTR{idProduct}=="0004", SYMLINK+="luna-test4-%k", MODE="660", GROUP="plugdev" +ATTR{idVendor}=="1209", ATTR{idProduct}=="0005", SYMLINK+="luna-test5-%k", MODE="660", GROUP="plugdev" + ATTR{idVendor}=="1d50", ATTR{idProduct}=="615c", SYMLINK+="apollo%k", MODE="660", GROUP="plugdev" ATTR{idVendor}=="1d50", ATTR{idProduct}=="615b", SYMLINK+="luna%k", MODE="660", GROUP="plugdev" diff --git a/contrib/54-luna-uaccess.rules b/contrib/54-luna-uaccess.rules index cd90bc934..deacaa0cf 100644 --- a/contrib/54-luna-uaccess.rules +++ b/contrib/54-luna-uaccess.rules @@ -1,5 +1,8 @@ -ATTR{idVendor}=="16d0", ATTR{idProduct}=="05a5", SYMLINK+="luna%k", TAG+="uaccess" -ATTR{idVendor}=="16d0", ATTR{idProduct}=="0f3b", SYMLINK+="lunatarget%k", TAG+="uaccess" +SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0001", SYMLINK+="luna-test1-%k", TAG+="uaccess" +SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0002", SYMLINK+="luna-test2-%k", TAG+="uaccess" +SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0003", SYMLINK+="luna-test3-%k", TAG+="uaccess" +SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0004", SYMLINK+="luna-test4-%k", TAG+="uaccess" +SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0005", SYMLINK+="luna-test5-%k", TAG+="uaccess" ATTR{idVendor}=="1d50", ATTR{idProduct}=="615c", SYMLINK+="apollo%k", TAG+="uaccess" ATTR{idVendor}=="1d50", ATTR{idProduct}=="615b", SYMLINK+="luna%k", TAG+="uaccess" diff --git a/examples/usb/acm_serial.py b/examples/usb/acm_serial.py index 288b20903..19d685fe3 100755 --- a/examples/usb/acm_serial.py +++ b/examples/usb/acm_serial.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause from amaranth import Elaboratable, Module @@ -23,7 +23,7 @@ def elaborate(self, platform): # Create our USB-to-serial converter. ulpi = platform.request(platform.default_usb_connection) m.submodules.usb_serial = usb_serial = \ - USBSerialDevice(bus=ulpi, idVendor=0x16d0, idProduct=0x0f3b) + USBSerialDevice(bus=ulpi, idVendor=0x1209, idProduct=0x0001) m.d.comb += [ # Place the streams into a loopback configuration... diff --git a/examples/usb/counter_device.py b/examples/usb/counter_device.py index 915003cc1..22f870d48 100755 --- a/examples/usb/counter_device.py +++ b/examples/usb/counter_device.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause import os @@ -39,8 +39,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Counter/Throughput Test" diff --git a/examples/usb/interrupt_device.py b/examples/usb/interrupt_device.py index abdfdad22..bae4e4cba 100755 --- a/examples/usb/interrupt_device.py +++ b/examples/usb/interrupt_device.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause import os @@ -37,8 +37,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Status interrupt mechanism" diff --git a/examples/usb/isochronous_count.py b/examples/usb/isochronous_count.py index 7b4e39898..977c6cf33 100755 --- a/examples/usb/isochronous_count.py +++ b/examples/usb/isochronous_count.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause import os @@ -38,8 +38,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Isochronous IN Test" diff --git a/examples/usb/loopback.py b/examples/usb/loopback.py index bf8897223..71d56af82 100755 --- a/examples/usb/loopback.py +++ b/examples/usb/loopback.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause import os @@ -36,8 +36,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "User IO streamer" diff --git a/examples/usb/simple_device.py b/examples/usb/simple_device.py index 325500bb6..729b0dba7 100755 --- a/examples/usb/simple_device.py +++ b/examples/usb/simple_device.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause import os @@ -31,8 +31,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Test Device" diff --git a/examples/usb/stream_out_device.py b/examples/usb/stream_out_device.py index 0c2230abe..d5dce8ff3 100755 --- a/examples/usb/stream_out_device.py +++ b/examples/usb/stream_out_device.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause import os @@ -36,8 +36,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "User IO streamer" diff --git a/examples/usb/stress_test_device.py b/examples/usb/stress_test_device.py index 16ddee561..eba92a2d4 100755 --- a/examples/usb/stress_test_device.py +++ b/examples/usb/stress_test_device.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause import os @@ -127,8 +127,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Stress Test" diff --git a/examples/usb/superspeed/simple_device.py b/examples/usb/superspeed/simple_device.py index 814c75302..45f5f4cee 100755 --- a/examples/usb/superspeed/simple_device.py +++ b/examples/usb/superspeed/simple_device.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause from amaranth import * @@ -32,8 +32,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 # We're complying with the USB 3.2 standard. d.bcdUSB = 3.2 diff --git a/examples/usb/superspeed/stream_in_device.py b/examples/usb/superspeed/stream_in_device.py index 85165f084..71ca0c2e7 100755 --- a/examples/usb/superspeed/stream_in_device.py +++ b/examples/usb/superspeed/stream_in_device.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause from amaranth import * @@ -34,8 +34,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 # We're complying with the USB 3.2 standard. d.bcdUSB = 3.2 diff --git a/examples/usb/superspeed/vendor_request.py b/examples/usb/superspeed/vendor_request.py index 4c223a3d6..498663ed6 100755 --- a/examples/usb/superspeed/vendor_request.py +++ b/examples/usb/superspeed/vendor_request.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause from amaranth import * @@ -105,8 +105,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 # We're complying with the USB 3.2 standard. d.bcdUSB = 3.2 diff --git a/examples/usb/vendor_request.py b/examples/usb/vendor_request.py index 45e178ee6..26aad75fb 100755 --- a/examples/usb/vendor_request.py +++ b/examples/usb/vendor_request.py @@ -2,7 +2,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause from amaranth import Elaboratable, Module, Cat @@ -81,8 +81,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Fancy USB-Controlled LEDs" diff --git a/luna/gateware/applets/speed_test.py b/luna/gateware/applets/speed_test.py index a1d30e89e..9b8665566 100644 --- a/luna/gateware/applets/speed_test.py +++ b/luna/gateware/applets/speed_test.py @@ -1,3 +1,9 @@ +# +# This file is part of LUNA. +# +# Copyright (c) 2020-2024 Great Scott Gadgets +# SPDX-License-Identifier: BSD-3-Clause + from amaranth import * from usb_protocol.emitters import DeviceDescriptorCollection, SuperSpeedDeviceDescriptorCollection @@ -9,8 +15,8 @@ from apollo_fpga.gateware.advertiser import ApolloAdvertiser, ApolloAdvertiserRequestHandler -VENDOR_ID = 0x16d0 -PRODUCT_ID = 0x0f3b +VENDOR_ID = 0x1209 +PRODUCT_ID = 0x0001 BULK_ENDPOINT_NUMBER = 1 @@ -178,8 +184,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 # We're complying with the USB 3.2 standard. d.bcdUSB = 3.2 diff --git a/luna/gateware/usb/devices/ila.py b/luna/gateware/usb/devices/ila.py index b5d30961f..6949ebafc 100644 --- a/luna/gateware/usb/devices/ila.py +++ b/luna/gateware/usb/devices/ila.py @@ -1,7 +1,7 @@ # # This file is part of LUNA. # -# Copyright (c) 2020 Great Scott Gadgets +# Copyright (c) 2020-2024 Great Scott Gadgets # SPDX-License-Identifier: BSD-3-Clause """ Pre-made gateware that implements an ILA connection serial. """ @@ -72,8 +72,8 @@ def create_descriptors(self): # We'll need a device descriptor... with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0x05a5 + d.idVendor = 0x1209 + d.idProduct = 0x0002 d.iManufacturer = "LUNA" d.iProduct = "Integrated Logic Analyzer" @@ -162,7 +162,7 @@ def __init__(self, *args, ila, delay=3, **kwargs): time.sleep(delay) # Create our USB connection the device - self._device = usb.core.find(idVendor=0x16d0, idProduct=0x5a5) + self._device = usb.core.find(idVendor=0x1209, idProduct=0x0002) super().__init__(ila) diff --git a/tests/test_usb2_device.py b/tests/test_usb2_device.py index 1d5f005c1..06a89a6ac 100644 --- a/tests/test_usb2_device.py +++ b/tests/test_usb2_device.py @@ -43,8 +43,8 @@ def provision_dut(self, dut): self.descriptors = descriptors = DeviceDescriptorCollection() with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Test Device" @@ -163,8 +163,8 @@ def provision_dut(self, dut): self.descriptors = descriptors = DeviceDescriptorCollection() with descriptors.DeviceDescriptor() as d: - d.idVendor = 0x16d0 - d.idProduct = 0xf3b + d.idVendor = 0x1209 + d.idProduct = 0x0001 d.iManufacturer = "LUNA" d.iProduct = "Test Device" From 27069e951246f8e8f391f5090a146eff86b59639 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Tue, 2 Jul 2024 17:37:16 -0400 Subject: [PATCH 2/2] Remove Cynthion VID/PIDs from udev rules These should be installed by the Cynthion project. --- contrib/54-luna-plugdev.rules | 3 --- contrib/54-luna-uaccess.rules | 3 --- 2 files changed, 6 deletions(-) diff --git a/contrib/54-luna-plugdev.rules b/contrib/54-luna-plugdev.rules index 2c4f72bce..f8ede1b83 100644 --- a/contrib/54-luna-plugdev.rules +++ b/contrib/54-luna-plugdev.rules @@ -3,6 +3,3 @@ ATTR{idVendor}=="1209", ATTR{idProduct}=="0002", SYMLINK+="luna-test2-%k", MODE= ATTR{idVendor}=="1209", ATTR{idProduct}=="0003", SYMLINK+="luna-test3-%k", MODE="660", GROUP="plugdev" ATTR{idVendor}=="1209", ATTR{idProduct}=="0004", SYMLINK+="luna-test4-%k", MODE="660", GROUP="plugdev" ATTR{idVendor}=="1209", ATTR{idProduct}=="0005", SYMLINK+="luna-test5-%k", MODE="660", GROUP="plugdev" - -ATTR{idVendor}=="1d50", ATTR{idProduct}=="615c", SYMLINK+="apollo%k", MODE="660", GROUP="plugdev" -ATTR{idVendor}=="1d50", ATTR{idProduct}=="615b", SYMLINK+="luna%k", MODE="660", GROUP="plugdev" diff --git a/contrib/54-luna-uaccess.rules b/contrib/54-luna-uaccess.rules index deacaa0cf..e653021b7 100644 --- a/contrib/54-luna-uaccess.rules +++ b/contrib/54-luna-uaccess.rules @@ -3,6 +3,3 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0002", SYMLINK+="lun SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0003", SYMLINK+="luna-test3-%k", TAG+="uaccess" SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0004", SYMLINK+="luna-test4-%k", TAG+="uaccess" SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0005", SYMLINK+="luna-test5-%k", TAG+="uaccess" - -ATTR{idVendor}=="1d50", ATTR{idProduct}=="615c", SYMLINK+="apollo%k", TAG+="uaccess" -ATTR{idVendor}=="1d50", ATTR{idProduct}=="615b", SYMLINK+="luna%k", TAG+="uaccess"