3 /// Attempt to reset all connected Blackberry devices via software
5 /// This file is part of the Barry project:
7 /// http://www.netdirect.ca/software/packages/barry/index.php
8 /// http://sourceforge.net/projects/barry
10 /// Compile with the following command (needs libusb):
12 /// g++ -o breset breset.cc -lusb
16 Copyright (C) 2007, Net Direct Inc. (http://www.netdirect.ca/)
18 This program is free software; you can redistribute it and/or modify
19 it under the terms of the GNU General Public License as published by
20 the Free Software Foundation; either version 2 of the License, or
21 (at your option) any later version.
23 This program is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 See the GNU General Public License in the COPYING file at the
28 root directory of this project for more details.
35 #define VENDOR_RIM 0x0fca
36 #define PRODUCT_RIM_BLACKBERRY 0x0001
37 #define PRODUCT_RIM_PEARL 0x0006
39 #define BLACKBERRY_INTERFACE 0
40 #define BLACKBERRY_CONFIGURATION 1
42 void reset(struct usb_device
*dev
)
44 usb_dev_handle
*handle
= usb_open(dev
);
54 struct usb_bus
*busses
;
59 busses
= usb_get_busses();
61 printf("Scanning for Blackberry devices...\n");
65 for( bus
= busses
; bus
; bus
= bus
->next
) {
66 struct usb_device
*dev
;
68 for (dev
= bus
->devices
; dev
; dev
= dev
->next
) {
69 // Is this a blackberry?
70 if( dev
->descriptor
.idVendor
== VENDOR_RIM
&&
71 (dev
->descriptor
.idProduct
== PRODUCT_RIM_BLACKBERRY
||
72 dev
->descriptor
.idProduct
== PRODUCT_RIM_PEARL
) ) {
74 printf("attempting to reset.\n");
81 printf("%d device%s reset.\n", found
, found
> 1 ? "s" : "");