nolo: In nolo_init check if device match to usb device, remove detected_ prefix
This commit is contained in:
1 parent
230d45c9e3
commit
26c1c2914e
1 file changed
+16
-2
+16
-2
@@ -159,12 +159,26 @@ static int nolo_get_version_string(struct usb_device_info * dev, const char * st
|
|||||||
int nolo_init(struct usb_device_info * dev) {
|
int nolo_init(struct usb_device_info * dev) {
|
||||||
|
|
||||||
uint32_t val = 1;
|
uint32_t val = 1;
|
||||||
|
enum device device;
|
||||||
|
|
||||||
printf("Initializing NOLO...\n");
|
printf("Initializing NOLO...\n");
|
||||||
|
|
||||||
while ( val != 0 )
|
while ( val != 0 )
|
||||||
if ( usb_control_msg(dev->udev, NOLO_QUERY, NOLO_STATUS, 0, 0, (char *)&val, 4, 2000) == -1 )
|
if ( usb_control_msg(dev->udev, NOLO_QUERY, NOLO_STATUS, 0, 0, (char *)&val, 4, 2000) == -1 )
|
||||||
ERROR_RETURN("NOLO_STATUS failed", -1);
|
ERROR_RETURN("NOLO_STATUS failed", -1);
|
||||||
|
|
||||||
|
device = nolo_get_device(dev);
|
||||||
|
|
||||||
|
if ( ! dev->device )
|
||||||
|
dev->device = device;
|
||||||
|
|
||||||
|
if ( dev->device && device && dev->device != device ) {
|
||||||
|
ERROR("Device mishmash, expected %s, got %s", device_to_string(dev->device), device_to_string(device));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev->hwrev = nolo_get_hwrev(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +261,7 @@ static int nolo_send_image(struct usb_device_info * dev, struct image * image, i
|
|||||||
struct device_list * device = image->devices;
|
struct device_list * device = image->devices;
|
||||||
|
|
||||||
while ( device ) {
|
while ( device ) {
|
||||||
if ( device->device == dev->detected_device && hwrev_is_valid(device->hwrevs, dev->detected_hwrev) )
|
if ( device->device == dev->device && hwrev_is_valid(device->hwrevs, dev->hwrev) )
|
||||||
break;
|
break;
|
||||||
device = device->next;
|
device = device->next;
|
||||||
}
|
}
|
||||||
@@ -258,7 +272,7 @@ static int nolo_send_image(struct usb_device_info * dev, struct image * image, i
|
|||||||
if ( bufs ) {
|
if ( bufs ) {
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
snprintf(buf, 8, "%d", dev->detected_hwrev);
|
snprintf(buf, 8, "%d", dev->hwrev);
|
||||||
|
|
||||||
for ( i = 0; bufs[i]; ++i ) {
|
for ( i = 0; bufs[i]; ++i ) {
|
||||||
len = ((uint8_t*)bufs[i])[0];
|
len = ((uint8_t*)bufs[i])[0];
|
||||||
|
|||||||
Reference in new issue
Block a user