// SPDX-License-Identifier: GPL-2.0-or-later /* * Force feedback support for DragonRise Inc. game controllers * * From what I have gathered, these devices are mass produced in China and are * distributed under several vendors. They often share the same design as * the original PlayStation DualShock controller. * * 0079:0006 "DragonRise Inc. Generic USB Joystick " * - tested with a Tesun USB-703 game controller. * * Copyright (c) 2009 Richard Walmsley <richwalm@gmail.com>
*/
/* While reverse engineering this device, I found that when this value is set, it causes the strong rumble to function
at a near maximum speed, so we'll bypass it. */ if (weak == 0x0a)
weak = 0x0b;
if (list_empty(&hid->inputs)) {
hid_err(hid, "no inputs found\n"); return -ENODEV;
}
hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
dev = hidinput->input;
if (list_empty(report_list)) {
hid_err(hid, "no output reports found\n"); return -ENODEV;
}
report = list_first_entry(report_list, struct hid_report, list); if (report->maxfield < 1) {
hid_err(hid, "no fields in the report\n"); return -ENODEV;
}
if (report->field[0]->report_count < 7) {
hid_err(hid, "not enough values in the field\n"); return -ENODEV;
}
drff = kzalloc(sizeof(struct drff_device), GFP_KERNEL); if (!drff) return -ENOMEM;
staticint dr_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsignedlong **bit, int *max)
{ switch (usage->hid) { /* * revert to the old hid-input behavior where axes * can be randomly assigned when hid->usage is reused.
*/ case HID_GD_X: case HID_GD_Y: case HID_GD_Z: case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: if (field->flags & HID_MAIN_ITEM_RELATIVE)
map_rel(usage->hid & 0xf); else
map_abs(usage->hid & 0xf); return 1;
}
return 0;
}
staticint dr_probe(struct hid_device *hdev, conststruct hid_device_id *id)
{ int ret;
dev_dbg(&hdev->dev, "DragonRise Inc. HID hardware probe...");
ret = hid_parse(hdev); if (ret) {
hid_err(hdev, "parse failed\n"); goto err;
}
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); if (ret) {
hid_err(hdev, "hw start failed\n"); goto err;
}
switch (hdev->product) { case 0x0006:
ret = drff_init(hdev); if (ret) {
dev_err(&hdev->dev, "force feedback init failed\n");
hid_hw_stop(hdev); goto err;
} break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.