3 /// Tool for probing identifying Blackberry devices
7 Copyright (C) 2005-2008, 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>
28 using namespace Barry
;
33 const char *Version
= Barry::Version(major
, minor
);
36 << "bidentify - USB Blackberry Identifier Tool\n"
37 << " Copyright 2005-2008, Net Direct Inc. (http://www.netdirect.ca/)\n"
38 << " Using: " << Version
<< "\n"
40 << " -B bus Specify which USB bus to search on\n"
41 << " -N dev Specify which system device, using system specific string\n"
44 << " -v Dump protocol data during operation\n"
48 int main(int argc
, char *argv
[])
50 cout
.sync_with_stdio(true); // leave this on, since libusb uses
51 // stdio for debug messages
55 bool data_dump
= false;
59 // process command line options
61 int cmd
= getopt(argc
, argv
, "B:hN:v");
75 case 'v': // data dump on
86 Barry::Init(data_dump
);
87 Barry::Probe
probe(busname
.c_str(), devname
.c_str());
89 // show any errors during probe first
90 if( probe
.GetFailCount() ) {
91 cerr
<< "Blackberry device errors with errors during probe:" << endl
;
92 for( int i
= 0; i
< probe
.GetFailCount(); i
++ ) {
93 cerr
<< probe
.GetFailMsg(i
) << endl
;
97 // show all successfully found devices
98 for( int i
= 0; i
< probe
.GetCount(); i
++ ) {
99 const ProbeResult
&pr
= probe
.Get(i
);
100 cout
<< hex
<< pr
.m_pin
<< ", "
101 << pr
.m_description
<< endl
;
104 return probe
.GetFailCount();
107 catch( std::exception
&e
) {
108 cerr
<< "exception caught: " << e
.what() << endl
;