hwrev is int16_t
This commit is contained in:
1 parent
0d6b32c371
commit
d636ef78dd
3 files changed
+6
-8
No files matched your search
+4
-5
@@ -288,13 +288,12 @@ void filter_images_by_device(enum device device, struct image_list ** image_firs
|
||||
|
||||
}
|
||||
|
||||
void filter_images_by_hwrev(const char * hwrev, struct image_list ** image_first) {
|
||||
void filter_images_by_hwrev(int16_t hwrev, struct image_list ** image_first) {
|
||||
|
||||
struct image_list * image_ptr = *image_first;
|
||||
int num = atoi(hwrev);
|
||||
while ( image_ptr ) {
|
||||
struct image_list * next = image_ptr->next;
|
||||
if ( ! image_hwrev_is_valid(image_ptr->image, num) ) {
|
||||
if ( ! image_hwrev_is_valid(image_ptr->image, hwrev) ) {
|
||||
image_list_del(image_ptr);
|
||||
if ( image_ptr == *image_first )
|
||||
*image_first = next;
|
||||
@@ -716,7 +715,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
/* filter images by hwrev */
|
||||
if ( filter_hwrev )
|
||||
filter_images_by_hwrev(filter_hwrev_arg, &image_first);
|
||||
filter_images_by_hwrev(atoi(filter_hwrev_arg), &image_first);
|
||||
|
||||
/* reorder images for flashing (first x-loader, second secondary) */
|
||||
/* set 2nd and secondary images for cold-flashing */
|
||||
@@ -964,7 +963,7 @@ int main(int argc, char **argv) {
|
||||
printf("HW revision: %s\n", buf[0] ? buf : "(not detected)");
|
||||
|
||||
if ( buf[0] )
|
||||
usb_dev->detected_hwrev = strdup(buf);
|
||||
usb_dev->detected_hwrev = atoi(buf);
|
||||
|
||||
buf[0] = 0;
|
||||
nolo_get_nolo_ver(usb_dev, buf, sizeof(buf));
|
||||
|
||||
+1
-2
@@ -160,7 +160,7 @@ static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
|
||||
}
|
||||
|
||||
ret->detected_device = DEVICE_UNKNOWN;
|
||||
ret->detected_hwrev = NULL;
|
||||
ret->detected_hwrev = -1;
|
||||
ret->flash_device = &usb_devices[i];
|
||||
ret->udev = udev;
|
||||
break;
|
||||
@@ -250,7 +250,6 @@ struct usb_device_info * usb_open_and_wait_for_device(void) {
|
||||
void usb_close_device(struct usb_device_info * dev) {
|
||||
|
||||
usb_close(dev->udev);
|
||||
free(dev->detected_hwrev);
|
||||
free(dev);
|
||||
|
||||
}
|
||||
+1
-1
@@ -44,7 +44,7 @@ struct usb_flash_device {
|
||||
|
||||
struct usb_device_info {
|
||||
enum device detected_device;
|
||||
char * detected_hwrev;
|
||||
int16_t detected_hwrev;
|
||||
const struct usb_flash_device * flash_device;
|
||||
usb_dev_handle * udev;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user