3 /// Tool for probing identifying Blackberry devices
7 Copyright (C) 2005-2010, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include <barry/barry.h>
29 using namespace Barry
;
34 const char *Version
= Barry::Version(major
, minor
);
37 << "bidentify - USB Blackberry Identifier Tool\n"
38 << " Copyright 2005-2010, Net Direct Inc. (http://www.netdirect.ca/)\n"
39 << " Using: " << Version
<< "\n"
41 << " -B bus Specify which USB bus to search on\n"
42 << " -N dev Specify which system device, using system specific string\n"
45 << " -v Dump protocol data during operation\n"
49 int main(int argc
, char *argv
[])
53 cout
.sync_with_stdio(true); // leave this on, since libusb uses
54 // stdio for debug messages
58 bool data_dump
= false;
62 // process command line options
64 int cmd
= getopt(argc
, argv
, "B:hN:v");
78 case 'v': // data dump on
89 Barry::Init(data_dump
);
90 Barry::Probe
probe(busname
.c_str(), devname
.c_str());
92 // show any errors during probe first
93 if( probe
.GetFailCount() ) {
94 cerr
<< "Blackberry device errors with errors during probe:" << endl
;
95 for( int i
= 0; i
< probe
.GetFailCount(); i
++ ) {
96 cerr
<< probe
.GetFailMsg(i
) << endl
;
100 // show all successfully found devices
101 for( int i
= 0; i
< probe
.GetCount(); i
++ ) {
102 const ProbeResult
&pr
= probe
.Get(i
);
103 cout
<< pr
.m_pin
.str() << ", "
104 << pr
.m_description
<< endl
;
107 return probe
.GetFailCount();
110 catch( std::exception
&e
) {
111 cerr
<< "exception caught: " << e
.what() << endl
;