diff --git a/NEWS b/NEWS index 5a27ccc3..49e044e6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +== Release 0.8.1 [2022-10-13] + * Fix bug preventing specifying a device with libusb0 + * Fix bug in order device id was printed with libusb0 + == Release 0.8.0 [2016-01-19] * Experimental support for ST cortex M4 * Enable GitHub Actions for releases [2022-10-13] diff --git a/configure.ac b/configure.ac index 9dcf9dbf..ac766df0 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([dfu-programmer],[0.8.0],[],[],[https://github.com/dfu-programmer/dfu-programmer]) +AC_INIT([dfu-programmer],[0.8.1],[],[],[https://github.com/dfu-programmer/dfu-programmer]) AC_CONFIG_AUX_DIR(m4) AC_CONFIG_SRCDIR([src/atmel.c]) AM_INIT_AUTOMAKE diff --git a/src/arguments.c b/src/arguments.c index 5021ce14..54ccc7b5 100644 --- a/src/arguments.c +++ b/src/arguments.c @@ -432,9 +432,9 @@ static int32_t assign_target( struct programmer_arguments *args, int address = 0; if( 2 != sscanf(&value[name_len+1], "%i,%i", &bus, &address) ) return -1; - if (bus <= 0) return -1; - if (address <= 0) return -1; - args->bus_id = bus; + if (bus < 0) return -1; + if (address < 0) return -1; + args->bus_id = bus + 1; args->device_address = address; } args->device_type = map->device_type; diff --git a/src/arguments.h b/src/arguments.h index 55757a32..c3251186 100644 --- a/src/arguments.h +++ b/src/arguments.h @@ -159,7 +159,7 @@ struct programmer_arguments { enum targets_enum target; uint16_t vendor_id; uint16_t chip_id; - uint16_t bus_id; /* if non-zero, use bus_id and device_address */ + uint16_t bus_id; /* if non-zero, use bus_id-1 and device_address */ uint16_t device_address; /* to identify the specific target device. */ atmel_device_class_t device_type; char device_type_string[DEVICE_TYPE_STRING_MAX_LENGTH]; diff --git a/src/dfu.c b/src/dfu.c index 9150e51b..19fb539a 100644 --- a/src/dfu.c +++ b/src/dfu.c @@ -349,7 +349,7 @@ struct libusb_device *dfu_device_init( const uint32_t vendor, if( (vendor == descriptor.idVendor) && (product == descriptor.idProduct) && ((bus_number == 0) - || ((libusb_get_bus_number(device) == bus_number) && + || ((libusb_get_bus_number(device)+1 == bus_number) && (libusb_get_device_address(device) == device_address))) ) { int32_t tmp; @@ -433,10 +433,10 @@ struct usb_device *dfu_device_init( const uint32_t vendor, && (product == device->descriptor.idProduct) && ((bus_number == 0) || (device->devnum == device_address - && (usb_bus->location >> 24) == bus_number))) + && (usb_bus->location >> 24)+1 == bus_number))) { int32_t tmp; - DEBUG( "found device at USB:%d,%d\n", device->devnum, (usb_bus->location >> 24) ); + DEBUG( "found device at USB:%d,%d\n", (usb_bus->location >> 24), device->devnum ); /* We found a device that looks like it matches... * let's try to find the DFU interface, open the device * and claim it. */