+ if (!force && was_flashed) {
+ struct ao_usb_id new_id, old_id;
+ uint16_t *new_product, *old_product;
+ int new_len, old_len;
+
+ if (!ao_heximage_usb_id(load, &new_id)) {
+ fprintf(stderr, "Can't get new USB id\n");
+ done(cc, 1);
+ }
+
+ if (!ao_self_get_usb_id(cc, &old_id)) {
+ fprintf(stderr, "Can't get old USB id\n");
+ done(cc, 1);
+ }
+ if (new_id.vid != old_id.vid || new_id.pid != old_id.pid) {
+ fprintf(stderr, "USB ID mismatch (device is %04x/%04x image is %04x/%04x)\n",
+ old_id.vid, old_id.pid, new_id.vid, new_id.pid);
+ done(cc, 1);
+ }
+
+ new_product = ao_heximage_usb_product(load);
+ if (!new_product) {
+ fprintf(stderr, "Can't get new USB product name\n");
+ done(cc, 1);
+ }
+ old_product = ao_self_get_usb_product(cc);
+ if (!old_product) {
+ fprintf(stderr, "Can't get existing USB product name\n");
+ done(cc, 1);
+ }
+ new_len = ucs2len(new_product);
+ old_len = ucs2len(old_product);
+ if (new_len != old_len || memcmp(new_product, old_product, new_len * 2) != 0) {
+ fprintf(stderr, "USB product mismatch (device is ");
+ putucs2str(new_product, stderr);
+ fprintf(stderr, ", image is ");
+ putucs2str(old_product, stderr);
+ fprintf(stderr, ")\n");
+ done(cc, 1);
+ }
+ }
+