-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 114444 b: refs/heads/master c: bd28ce0 h: refs/heads/master v: v3
- Loading branch information
Jiri Slaby
authored and
Jiri Kosina
committed
Oct 14, 2008
1 parent
4b1f0f7
commit da96c11
Showing
9 changed files
with
124 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 2b88b803018dbc2e9c68cbcd1739186e0715911a | ||
refs/heads/master: bd28ce008bdc68ef5902f68d2d62cbb7fa78c415 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* HID driver for some sony "special" devices | ||
* | ||
* Copyright (c) 1999 Andreas Gal | ||
* Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
* Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
* Copyright (c) 2006-2007 Jiri Kosina | ||
* Copyright (c) 2007 Paul Walmsley | ||
* Copyright (c) 2008 Jiri Slaby | ||
*/ | ||
|
||
/* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation; either version 2 of the License, or (at your option) | ||
* any later version. | ||
*/ | ||
|
||
#include <linux/device.h> | ||
#include <linux/hid.h> | ||
#include <linux/module.h> | ||
#include <linux/usb.h> | ||
|
||
#include "hid-ids.h" | ||
|
||
/* | ||
* Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller | ||
* to "operational". Without this, the ps3 controller will not report any | ||
* events. | ||
*/ | ||
static int sony_set_operational(struct hid_device *hdev) | ||
{ | ||
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
struct usb_device *dev = interface_to_usbdev(intf); | ||
__u16 ifnum = intf->cur_altsetting->desc.bInterfaceNumber; | ||
int ret; | ||
char *buf = kmalloc(18, GFP_KERNEL); | ||
|
||
if (!buf) | ||
return -ENOMEM; | ||
|
||
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
HID_REQ_GET_REPORT, | ||
USB_DIR_IN | USB_TYPE_CLASS | | ||
USB_RECIP_INTERFACE, | ||
(3 << 8) | 0xf2, ifnum, buf, 17, | ||
USB_CTRL_GET_TIMEOUT); | ||
if (ret < 0) | ||
dev_err(&hdev->dev, "can't set operational mode\n"); | ||
|
||
kfree(buf); | ||
|
||
return ret; | ||
} | ||
|
||
static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
{ | ||
int ret; | ||
|
||
hdev->quirks |= HID_QUIRK_HIDDEV; | ||
|
||
ret = hid_parse(hdev); | ||
if (ret) { | ||
dev_err(&hdev->dev, "parse failed\n"); | ||
goto err_free; | ||
} | ||
|
||
ret = hid_hw_start(hdev); | ||
if (ret) { | ||
dev_err(&hdev->dev, "hw start failed\n"); | ||
goto err_free; | ||
} | ||
|
||
ret = sony_set_operational(hdev); | ||
if (ret) | ||
goto err_stop; | ||
|
||
return 0; | ||
err_stop: | ||
hid_hw_stop(hdev); | ||
err_free: | ||
return ret; | ||
} | ||
|
||
static const struct hid_device_id sony_devices[] = { | ||
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(hid, sony_devices); | ||
|
||
static struct hid_driver sony_driver = { | ||
.name = "sony", | ||
.id_table = sony_devices, | ||
.probe = sony_probe, | ||
}; | ||
|
||
static int sony_init(void) | ||
{ | ||
return hid_register_driver(&sony_driver); | ||
} | ||
|
||
static void sony_exit(void) | ||
{ | ||
hid_unregister_driver(&sony_driver); | ||
} | ||
|
||
module_init(sony_init); | ||
module_exit(sony_exit); | ||
MODULE_LICENSE("GPL"); | ||
|
||
HID_COMPAT_LOAD_DRIVER(sony); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters