diff options
author | Jeremy Katz <katzj@redhat.com> | 2007-06-19 17:15:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:34:40 -0400 |
commit | 49bb607fa0bd94e4855ee695f9ed3ecee7579cc6 (patch) | |
tree | b4a317ed73f788f6bd8de04886968c921dd49c90 /drivers/usb/misc | |
parent | 165fe97ed6107d3cde63592d5ac36400a5eb9f6f (diff) |
USB: Support Blackberry Pearl with berry_charge
The Blackberry Pearl (8100) needs similar tweaks as older Blackberry models
to be able to charge when connected via USB. The Pearl also adds an
additional need to go into a separate mode for fully accessing the device;
do that by default as well.
Changes based on the changes from bcharge in the barry project
(http://barry.sf.net)
Signed-off-by: Jeremy Katz <katzj@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/berry_charge.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/usb/misc/berry_charge.c b/drivers/usb/misc/berry_charge.c index b15f2fd8dab4..92c1d2768df9 100644 --- a/drivers/usb/misc/berry_charge.c +++ b/drivers/usb/misc/berry_charge.c | |||
@@ -26,8 +26,11 @@ | |||
26 | 26 | ||
27 | #define RIM_VENDOR 0x0fca | 27 | #define RIM_VENDOR 0x0fca |
28 | #define BLACKBERRY 0x0001 | 28 | #define BLACKBERRY 0x0001 |
29 | #define BLACKBERRY_PEARL_DUAL 0x0004 | ||
30 | #define BLACKBERRY_PEARL 0x0006 | ||
29 | 31 | ||
30 | static int debug; | 32 | static int debug; |
33 | static int pearl_dual_mode = 1; | ||
31 | 34 | ||
32 | #ifdef dbg | 35 | #ifdef dbg |
33 | #undef dbg | 36 | #undef dbg |
@@ -38,6 +41,8 @@ static int debug; | |||
38 | 41 | ||
39 | static struct usb_device_id id_table [] = { | 42 | static struct usb_device_id id_table [] = { |
40 | { USB_DEVICE(RIM_VENDOR, BLACKBERRY) }, | 43 | { USB_DEVICE(RIM_VENDOR, BLACKBERRY) }, |
44 | { USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL) }, | ||
45 | { USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL_DUAL) }, | ||
41 | { }, /* Terminating entry */ | 46 | { }, /* Terminating entry */ |
42 | }; | 47 | }; |
43 | MODULE_DEVICE_TABLE(usb, id_table); | 48 | MODULE_DEVICE_TABLE(usb, id_table); |
@@ -86,6 +91,30 @@ static int magic_charge(struct usb_device *udev) | |||
86 | return retval; | 91 | return retval; |
87 | } | 92 | } |
88 | 93 | ||
94 | static int magic_dual_mode(struct usb_device *udev) | ||
95 | { | ||
96 | char *dummy_buffer = kzalloc(2, GFP_KERNEL); | ||
97 | int retval; | ||
98 | |||
99 | if (!dummy_buffer) | ||
100 | return -ENOMEM; | ||
101 | |||
102 | /* send magic command so that the Blackberry Pearl device exposes | ||
103 | * two interfaces: both the USB mass-storage one and one which can | ||
104 | * be used for database access. */ | ||
105 | dbg(&udev->dev, "Sending magic pearl command\n"); | ||
106 | retval = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
107 | 0xa9, 0xc0, 1, 1, dummy_buffer, 2, 100); | ||
108 | dbg(&udev->dev, "Magic pearl command returned %d\n", retval); | ||
109 | |||
110 | dbg(&udev->dev, "Calling set_configuration\n"); | ||
111 | retval = usb_driver_set_configuration(udev, 1); | ||
112 | if (retval) | ||
113 | dev_err(&udev->dev, "Set Configuration failed :%d.\n", retval); | ||
114 | |||
115 | return retval; | ||
116 | } | ||
117 | |||
89 | static int berry_probe(struct usb_interface *intf, | 118 | static int berry_probe(struct usb_interface *intf, |
90 | const struct usb_device_id *id) | 119 | const struct usb_device_id *id) |
91 | { | 120 | { |
@@ -105,6 +134,10 @@ static int berry_probe(struct usb_interface *intf, | |||
105 | /* turn the power on */ | 134 | /* turn the power on */ |
106 | magic_charge(udev); | 135 | magic_charge(udev); |
107 | 136 | ||
137 | if ((le16_to_cpu(udev->descriptor.idProduct) == BLACKBERRY_PEARL) && | ||
138 | (pearl_dual_mode)) | ||
139 | magic_dual_mode(udev); | ||
140 | |||
108 | /* we don't really want to bind to the device, userspace programs can | 141 | /* we don't really want to bind to the device, userspace programs can |
109 | * handle the syncing just fine, so get outta here. */ | 142 | * handle the syncing just fine, so get outta here. */ |
110 | return -ENODEV; | 143 | return -ENODEV; |
@@ -138,3 +171,5 @@ MODULE_LICENSE("GPL"); | |||
138 | MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>"); | 171 | MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>"); |
139 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 172 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
140 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 173 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |
174 | module_param(pearl_dual_mode, bool, S_IRUGO | S_IWUSR); | ||
175 | MODULE_PARM_DESC(pearl_dual_mode, "Change Blackberry Pearl to run in dual mode"); | ||