aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2008-08-20 13:13:52 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:57 -0400
commit0f37cd0306463ad35f958d8f74a2b00e5b190b4b (patch)
tree09334d4bb4b944d598c0930ba70c8a60280c8c77
parent606bd0a8616a0e59021cb2997e942513f24f641d (diff)
HID: introduce list for hiddev creation forcing
Introduce a list of devices for which there is need to force a creation of the hiddev interface, but still they are operated by generic driver (i.e. certain UPS). Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-core.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 6a730df336b4..ec299f56c58b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1113,6 +1113,33 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
1113} 1113}
1114EXPORT_SYMBOL_GPL(hid_input_report); 1114EXPORT_SYMBOL_GPL(hid_input_report);
1115 1115
1116static bool hid_match_one_id(struct hid_device *hdev,
1117 const struct hid_device_id *id)
1118{
1119 return id->bus == hdev->bus &&
1120 (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) &&
1121 (id->product == HID_ANY_ID || id->product == hdev->product);
1122}
1123
1124static const struct hid_device_id *hid_match_id(struct hid_device *hdev,
1125 const struct hid_device_id *id)
1126{
1127 for (; id->bus; id++)
1128 if (hid_match_one_id(hdev, id))
1129 return id;
1130
1131 return NULL;
1132}
1133
1134static const struct hid_device_id hid_hiddev_list[] = {
1135 { }
1136};
1137
1138static bool hid_hiddev(struct hid_device *hdev)
1139{
1140 return !!hid_match_id(hdev, hid_hiddev_list);
1141}
1142
1116int hid_connect(struct hid_device *hdev, unsigned int connect_mask) 1143int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1117{ 1144{
1118 static const char *types[] = { "Device", "Pointer", "Mouse", "Device", 1145 static const char *types[] = { "Device", "Pointer", "Mouse", "Device",
@@ -1126,6 +1153,8 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1126 1153
1127 if (hdev->bus != BUS_USB) 1154 if (hdev->bus != BUS_USB)
1128 connect_mask &= ~HID_CONNECT_HIDDEV; 1155 connect_mask &= ~HID_CONNECT_HIDDEV;
1156 if (hid_hiddev(hdev))
1157 connect_mask |= HID_CONNECT_HIDDEV_FORCE;
1129 1158
1130 if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, 1159 if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev,
1131 connect_mask & HID_CONNECT_HIDINPUT_FORCE)) 1160 connect_mask & HID_CONNECT_HIDINPUT_FORCE))
@@ -1187,24 +1216,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1187} 1216}
1188EXPORT_SYMBOL_GPL(hid_connect); 1217EXPORT_SYMBOL_GPL(hid_connect);
1189 1218
1190static bool hid_match_one_id(struct hid_device *hdev,
1191 const struct hid_device_id *id)
1192{
1193 return id->bus == hdev->bus &&
1194 (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) &&
1195 (id->product == HID_ANY_ID || id->product == hdev->product);
1196}
1197
1198static const struct hid_device_id *hid_match_id(struct hid_device *hdev,
1199 const struct hid_device_id *id)
1200{
1201 for (; id->bus; id++)
1202 if (hid_match_one_id(hdev, id))
1203 return id;
1204
1205 return NULL;
1206}
1207
1208static const struct hid_device_id hid_blacklist[] = { 1219static const struct hid_device_id hid_blacklist[] = {
1209 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1220 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
1210 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 1221 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },