Skip to content

Commit

Permalink
Merge branch 'cinderblock/fix-libusb0-busid' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cinderblock committed Oct 13, 2022
2 parents 84bf3ce + 1171191 commit 4829bd1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions 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]
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/arguments.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/arguments.h
Expand Up @@ -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];
Expand Down
6 changes: 3 additions & 3 deletions src/dfu.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 4829bd1

Please sign in to comment.