Skip to content

Commit

Permalink
Merge 0fac6e8 into 25f4474
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewman committed Feb 3, 2024
2 parents 25f4474 + 0fac6e8 commit c319095
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
9 changes: 8 additions & 1 deletion config/ola.m4
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ if test -z "$PROTOC" ; then
AC_MSG_ERROR([cannot find 'protoc' program]);
elif test -n "$1" ; then
AC_MSG_CHECKING([protoc version])
[protoc_version=`$PROTOC --version 2>&1 | grep 'libprotoc' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
# Since v20.x we only get effectively the minor and patch versions out of protoc.
# Treat them as major and minor and everything should keep working indefinitely.
# See https://protobuf.dev/support/version-support/
# So we've got either of these:
# libprotoc 2.4.1
# libprotoc 23.3
# The first sed ensures all versions have major, minor, patch, by adding a .0 on the end of ones missing it
[protoc_version=`$PROTOC --version 2>&1 | grep 'libprotoc' | sed 's/\([^\.0-9][0-9][0-9]*\.[0-9][0-9]*\)$/\1\.0/g' | sed 's/[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
[required=$1]
[required_major=`echo $required | sed 's/[^0-9].*//'`]
[required_minor=`echo $required | sed 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/'`]
Expand Down
3 changes: 3 additions & 0 deletions plugins/usbdmx/AVLdiyD512Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ bool AVLdiyD512Factory::DeviceAdded(
// Some AVLdiy devices don't have serial numbers. Since there isn't another
// good way to uniquely identify a USB device, we only support one of these
// types of devices per host.
// TODO(Peter): We could instead use the device & bus number (like the
// Eurolite plugin). You could use more than one device, but the patch
// wouldn't follow if you plugged it into a different port
if (info.serial.empty()) {
if (m_missing_serial_number) {
OLA_WARN << "Failed to read serial number or serial number empty. "
Expand Down
3 changes: 3 additions & 0 deletions plugins/usbdmx/AnymauDMXFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ bool AnymauDMXFactory::DeviceAdded(
// Some Anyma devices don't have serial numbers. Since there isn't another
// good way to uniquely identify a USB device, we only support one of these
// types of devices per host.
// TODO(Peter): We could instead use the device & bus number (like the
// Eurolite plugin). You could use more than one device, but the patch
// wouldn't follow if you plugged it into a different port
if (info.serial.empty()) {
if (m_missing_serial_number) {
OLA_WARN << "Failed to read serial number or serial number empty. "
Expand Down
3 changes: 3 additions & 0 deletions plugins/usbdmx/DMXCreator512BasicFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ bool DMXCreator512BasicFactory::DeviceAdded(
// vendor and product ids. Also, since DMXCreator 512 Basic devices don't have
// serial numbers and there is no other good way to uniquely identify a USB
// device, we only support one of these types of devices per host.
// TODO(Peter): We could instead use the device & bus number (like the
// Eurolite plugin). You could use more than one device, but the patch
// wouldn't follow if you plugged it into a different port
if (info.serial.empty()) {
if (m_missing_serial_number) {
OLA_WARN << "We can only support one device without a serial number.";
Expand Down
21 changes: 12 additions & 9 deletions plugins/usbdmx/EuroliteProFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ bool EuroliteProFactory::DeviceAdded(
libusb_device *usb_device,
const struct libusb_device_descriptor &descriptor) {
bool is_mk2 = false;
LibUsbAdaptor::DeviceInformation info;

// Eurolite USB-DMX512-PRO?
if (descriptor.idVendor == VENDOR_ID && descriptor.idProduct == PRODUCT_ID) {
OLA_INFO << "Found a new Eurolite USB-DMX512-PRO device";
LibUsbAdaptor::DeviceInformation info;
if (!m_adaptor->GetDeviceInfo(usb_device, descriptor, &info)) {
return false;
}
Expand All @@ -112,7 +112,6 @@ bool EuroliteProFactory::DeviceAdded(
// Eurolite USB-DMX512-PRO MK2?
} else if (descriptor.idVendor == VENDOR_ID_MK2 &&
descriptor.idProduct == PRODUCT_ID_MK2) {
LibUsbAdaptor::DeviceInformation info;
if (!m_adaptor->GetDeviceInfo(usb_device, descriptor, &info)) {
return false;
}
Expand Down Expand Up @@ -150,17 +149,21 @@ bool EuroliteProFactory::DeviceAdded(
return false;
}

// The Eurolite doesn't have a serial number, so instead we use the device &
// bus number.
// The original Eurolite doesn't have a serial number, so instead we use the
// device & bus number. The MK2 does, so we use that where available.
// TODO(simon): check if this supports the SERIAL NUMBER label and use that
// instead.

// There is no Serialnumber--> work around: bus+device number
int bus_number = libusb_get_bus_number(usb_device);
int device_address = libusb_get_device_address(usb_device);

std::ostringstream serial_str;
serial_str << bus_number << "-" << device_address;
if (is_mk2 && !info.serial.empty()) {
serial_str << info.serial;
} else {
// Original, there is no Serialnumber--> work around: bus+device number
int bus_number = libusb_get_bus_number(usb_device);
int device_address = libusb_get_device_address(usb_device);

serial_str << bus_number << "-" << device_address;
}

EurolitePro *widget = NULL;
if (FLAGS_use_async_libusb) {
Expand Down
3 changes: 3 additions & 0 deletions plugins/usbdmx/ScanlimeFadecandyFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ bool ScanlimeFadecandyFactory::DeviceAdded(
// Fadecandy devices may be missing serial numbers. Since there isn't another
// good way to uniquely identify a USB device, we only support one of these
// types of devices per host.
// TODO(Peter): We could instead use the device & bus number (like the
// Eurolite plugin). You could use more than one device, but the patch
// wouldn't follow if you plugged it into a different port
if (info.serial.empty()) {
if (m_missing_serial_number) {
OLA_WARN << "Failed to read serial number or serial number empty. "
Expand Down

0 comments on commit c319095

Please sign in to comment.