From 02f9df526849ad9cd67c839382dfe38ce337cb1c Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Thu, 22 Nov 2012 22:17:33 -0500 Subject: [PATCH] tools: added -s switch (usb serial number) to bidentify --- man/bidentify.1 | 9 +++++++-- tools/bidentify.cc | 13 ++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/man/bidentify.1 b/man/bidentify.1 index 2134dedd..08b6a6b3 100644 --- a/man/bidentify.1 +++ b/man/bidentify.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH BIDENTIFY 1 "February 24, 2011" +.TH BIDENTIFY 1 "November 22, 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -20,7 +20,7 @@ \- Barry Project's program to identify BlackBerry handhelds .SH SYNOPSIS .B bidentify -[\-B busname][\-N devname][\-h][\-v] +[\-B busname][\-N devname][\-c][\-m][\-s][\-h][\-v] .SH DESCRIPTION .PP .B bidentify @@ -51,6 +51,11 @@ Also show the device's ESN / MEID / IMEI number. This requires desktop database access, so is an option. It will only work on devices that have no password. .TP +.B \-s +Also show the device's USB serial number. This is the same serial number +that is available through the lsusb command line tool, and may not always +be what you expect. +.TP .B \-v Dump verbose protocol data during operation. .TP diff --git a/tools/bidentify.cc b/tools/bidentify.cc index 52012ef4..633f0080 100644 --- a/tools/bidentify.cc +++ b/tools/bidentify.cc @@ -43,6 +43,7 @@ void Usage() "\n" " -c If used with -m, show both hex and dec where possible\n" " -m Also show the device's ESN / MEID / IMEI\n" + " -s Also show the device's USB serial number (same as shown by lsusb)\n" " -h This help\n" " -v Dump protocol data during operation\n"), Version) << endl; @@ -81,13 +82,14 @@ int main(int argc, char *argv[]) bool data_dump = false, get_meid = false, + get_usb_serial = false, show_both = false; string busname; string devname; // process command line options for(;;) { - int cmd = getopt(argc, argv, "B:hN:vmc"); + int cmd = getopt(argc, argv, "B:hN:vmsc"); if( cmd == -1 ) break; @@ -109,6 +111,10 @@ int main(int argc, char *argv[]) get_meid = true; break; + case 's': // get usb serial number + get_usb_serial = true; + break; + case 'v': // data dump on data_dump = true; break; @@ -156,6 +162,11 @@ int main(int argc, char *argv[]) cerr << _("Error on PIN: ") << pr.m_pin.Str() << ": " << e.what() << endl; } + if( get_usb_serial ) { + Usb::Device dev(pr.m_dev); + cout << ", " << dev.GetSimpleSerialNumber(); + } + // finish the identity line cout << endl; } -- 2.11.4.GIT