diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:46:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:46:58 -0700 |
commit | 9374430a52dfae5c013b88f7f030c04a6774d410 (patch) | |
tree | ce1ee8eee4e79fbb9486e810278d1092afc74a44 /drivers/usb/misc/berry_charge.c | |
parent | 66f49739fe1591197364f2dad1b67b975e8f5e85 (diff) | |
parent | 13f9966b3ba5b45f47f2ea0eb0a90afceedfbb1f (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (149 commits)
USB: ohci-pnx4008: Remove unnecessary cast of return value of kzalloc
USB: additions to the quirk list
usb-storage: implement autosuspend
USB: cdc-acm: add new device id to option driver
USB: goku_udc trivial cleanups
USB: usb gadget stack can now -DDEBUG with Kconfig
usb gadget stack: remove usb_ep_*_buffer(), part 2
usb gadget stack: remove usb_ep_*_buffer(), part 1
USB: pxa2xx_udc -- cleanups, mostly removing dma hooks
USB: pxa2xx_udc: use generic gpio layer
USB: quirk for samsung printer
USB: usb/dma doc updates
USB: drivers/usb/storage/unusual_devs.h whitespace cleanup
USB: remove Makefile reference to obsolete OHCI_AT91
USB: io_*: remove bogus termios no change checks
USB: mos7720: remove bogus no termios change check
USB: visor and whiteheat: remove bogus termios change checks
USB: pl2303: remove bogus checks and fix speed support to use tty_get_baud_rate()
USB: mos7840.c: turn this into a serial driver
USB: make the usb_device numa_node get assigned from controller
...
Diffstat (limited to 'drivers/usb/misc/berry_charge.c')
-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 b15f2fd8dab..92c1d2768df 100644 --- a/drivers/usb/misc/berry_charge.c +++ b/drivers/usb/misc/berry_charge.c @@ -26,8 +26,11 @@ #define RIM_VENDOR 0x0fca #define BLACKBERRY 0x0001 +#define BLACKBERRY_PEARL_DUAL 0x0004 +#define BLACKBERRY_PEARL 0x0006 static int debug; +static int pearl_dual_mode = 1; #ifdef dbg #undef dbg @@ -38,6 +41,8 @@ static int debug; static struct usb_device_id id_table [] = { { USB_DEVICE(RIM_VENDOR, BLACKBERRY) }, + { USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL) }, + { USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL_DUAL) }, { }, /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, id_table); @@ -86,6 +91,30 @@ static int magic_charge(struct usb_device *udev) return retval; } +static int magic_dual_mode(struct usb_device *udev) +{ + char *dummy_buffer = kzalloc(2, GFP_KERNEL); + int retval; + + if (!dummy_buffer) + return -ENOMEM; + + /* send magic command so that the Blackberry Pearl device exposes + * two interfaces: both the USB mass-storage one and one which can + * be used for database access. */ + dbg(&udev->dev, "Sending magic pearl command\n"); + retval = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + 0xa9, 0xc0, 1, 1, dummy_buffer, 2, 100); + dbg(&udev->dev, "Magic pearl command returned %d\n", retval); + + dbg(&udev->dev, "Calling set_configuration\n"); + retval = usb_driver_set_configuration(udev, 1); + if (retval) + dev_err(&udev->dev, "Set Configuration failed :%d.\n", retval); + + return retval; +} + static int berry_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -105,6 +134,10 @@ static int berry_probe(struct usb_interface *intf, /* turn the power on */ magic_charge(udev); + if ((le16_to_cpu(udev->descriptor.idProduct) == BLACKBERRY_PEARL) && + (pearl_dual_mode)) + magic_dual_mode(udev); + /* we don't really want to bind to the device, userspace programs can * handle the syncing just fine, so get outta here. */ return -ENODEV; @@ -138,3 +171,5 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>"); module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); +module_param(pearl_dual_mode, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(pearl_dual_mode, "Change Blackberry Pearl to run in dual mode"); |