usb_modeswitch-data 20150115
libusbx-1.0.19-2.fc21
let me suggest that you check return value of libusb_get_active_config_descriptor.
and why does it check the global variable ret in get_current_configuration?
one funny thing: if I do this,Core was generated by `/usr/sbin/usb_modeswitch -Q -D -s 20 -b 3 -g 9 -v 12d1 -p 157d -f Configuratio'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __GI___libc_free (mem=0x100544d48) at malloc.c:2934
2934 if (chunk_is_mmapped (p)) /* release mmapped memory. */
Missing separate debuginfos, use: debuginfo-install usb_modeswitch-2.2.1-1.fc21.x86_64
(gdb) bt
#0 __GI___libc_free (mem=0x100544d48) at malloc.c:2934
#1 0x00007f7886fbe833 in clear_configuration () from /lib64/libusb-1.0.so.0
#2 0x00007f7886fbfa3e in libusb_free_config_descriptor () from /lib64/libusb-1.0.so.0
#3 0x00000000004035e5 in get_current_configuration () at usb_modeswitch.c:1814
#4 0x0000000000406c8b in main (argc=<optimized out>, argv=<optimized out>) at usb_modeswitch.c:732
Code: Select all
- case 'Q': show_progress = 0; verbose = 0; count--; break;
+ case 'Q': show_progress = 1; verbose = 0; count--; break;
okay, wasted two hours because of that.2015-02-12 21:45:36.944076920 [289236.845535] Read(10): 28 00 00 00 0f fe 00 00 02 00
2015-02-12 21:45:36.944077177 [289236.845547] blk_update_request: critical medium error, dev sr1, sector 16376
2015-02-12 21:45:36.962092834 [289236.863725] sr 55:0:0:0: [sr1] FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
2015-02-12 21:45:36.962093793 [289236.863728] sr 55:0:0:0: [sr1] Sense Key : Medium Error [current]
2015-02-12 21:45:36.962094150 [289236.863730] sr 55:0:0:0: [sr1] Add. Sense: Unrecovered read error
2015-02-12 21:45:36.962094462 [289236.863731] sr 55:0:0:0: [sr1] CDB:
okay, here fix for segfault
Code: Select all
--- usb_modeswitch.orig.c 2015-01-14 22:13:59.000000000 +0200
+++ usb_modeswitch.c 2015-02-12 21:51:11.556731968 +0200
@@ -575,6 +575,8 @@
} else
libusb_free_config_descriptor(active_config);
+ active_config = NULL;
+
if (interfaceClass == -1) {
fprintf(stderr, "Error: Could not get class of interface %d. Does it exist? Abort\n\n",Interface);
exit(1);
Code: Select all
--- usb_modeswitch.orig.c 2015-01-14 22:13:59.000000000 +0200
+++ usb_modeswitch.c 2015-02-12 21:57:42.648207760 +0200
@@ -1807,14 +1809,15 @@
{
int cfg;
SHOW_PROGRESS(output,"Get the current device configuration ...\n");
- if (active_config == NULL)
- libusb_get_active_config_descriptor(dev, &active_config);
+ if (active_config == NULL) {
+ ret = libusb_get_active_config_descriptor(dev, &active_config);
+ if (ret < 0)
+ exit(1);
+ }
cfg = active_config->bConfigurationValue;
libusb_free_config_descriptor(active_config);
- if (ret < 0)
- exit(1);
- else
+ active_config = NULL;
return cfg;
}