diff options
| -rw-r--r-- | hid-tmt300rs.c | 35 | ||||
| -rw-r--r-- | hid-tmt300rs.h | 4 |
2 files changed, 27 insertions, 12 deletions
diff --git a/hid-tmt300rs.c b/hid-tmt300rs.c index e11cab9..832bcfb 100644 --- a/hid-tmt300rs.c +++ b/hid-tmt300rs.c @@ -1,13 +1,13 @@ #include "hid-tmt300rs.h" -DEFINE_MUTEX(mtx); +struct hid_report *greport; +struct list_head *greport_list; static void t300rs_int_callback(struct urb *urb){ if(urb->status){ hid_warn(urb->dev, "urb status %i received\n", urb->status); } - mutex_unlock(&mtx); usb_free_urb(urb); } @@ -38,14 +38,14 @@ static int t300rs_send_int(struct input_dev *dev, u8 *send_buffer, int *trans){ struct usb_interface *usbif; struct usb_host_endpoint *ep; struct urb *urb = usb_alloc_urb(0, GFP_ATOMIC); - int ret; + int ret, i; t300rs = t300rs_get_device(hdev); if(!t300rs){ hid_err(hdev, "could not get device\n"); } - usbdev = t300rs->usbdev; + /* usbdev = t300rs->usbdev; usbif = t300rs->usbif; ep = &usbif->cur_altsetting->endpoint[1]; @@ -59,10 +59,22 @@ static int t300rs_send_int(struct input_dev *dev, u8 *send_buffer, int *trans){ hdev, ep->desc.bInterval ); + */ - mutex_lock(&mtx); + //ret = hid_hw_raw_request(t300rs->hdev, 0, send_buffer, T300RS_BUFFER_LENGTH, 73, HID_REQ_SET_REPORT); + s32 *value = greport->field[0]->value; + if(!value) + hid_err(t300rs->hdev, "fuck\n"); - return usb_submit_urb(urb, GFP_ATOMIC); + for(i = 0; i < 63; ++i){ + value[i] = send_buffer[i + 1]; + } + hid_hw_request(t300rs->hdev, greport, HID_REQ_SET_REPORT); + + return 0; + + + // return usb_submit_urb(urb, GFP_ATOMIC); } static int t300rs_play_effect(struct t300rs_device_entry *t300rs, struct t300rs_effect_state *state){ @@ -1166,7 +1178,7 @@ static void t300rs_set_gain(struct input_dev *dev, u16 gain){ ret = t300rs_send_int(dev, send_buffer, &trans); if(ret){ - hid_err(hdev, "failed setting gain\n"); + hid_err(hdev, "failed setting gain: %i\n", ret); } kfree(send_buffer); @@ -1613,8 +1625,6 @@ int t300rs_init(struct hid_device *hdev, const signed short *ff_bits){ char range[10] = "900"; /* max */ int i, ret; - mutex_init(&mtx); - drv_data = hid_get_drvdata(hdev); if(!drv_data){ hid_err(hdev, "private driver data not allocated\n"); @@ -1659,7 +1669,7 @@ int t300rs_init(struct hid_device *hdev, const signed short *ff_bits){ } switch(field->usage[0].hid){ - case 0xff00000a: + case -16777120: if(field->report_count < 2){ hid_warn(hdev, "ignoring FF field with report_count < 2\n"); continue; @@ -1690,7 +1700,7 @@ int t300rs_init(struct hid_device *hdev, const signed short *ff_bits){ break; default: - hid_warn(hdev, "ignoring unknown output usage\n"); + hid_warn(hdev, "ignoring unknown output usage: %i\n", field->usage[0].hid); continue; } } @@ -1727,6 +1737,9 @@ int t300rs_init(struct hid_device *hdev, const signed short *ff_bits){ goto out; } + greport_list = &t300rs->hdev->report_enum[HID_OUTPUT_REPORT].report_list; + greport = list_entry(report_list->next, struct hid_report, list);; + tmt300rs_controls(t300rs->hdev); t300rs_init_interrupts(t300rs); diff --git a/hid-tmt300rs.h b/hid-tmt300rs.h index e5bb58d..b622d15 100644 --- a/hid-tmt300rs.h +++ b/hid-tmt300rs.h @@ -87,7 +87,9 @@ struct t300rs_data{ void *device_props; }; -static __u8 t300rs_rdesc_fixed[] = {0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x85, 0x07, 0x09, 0x30, 0x15, 0x00, 0x27, 0xff, 0xff, 0x00, 0x00, 0x35, 0x00, 0x47, 0xff, 0xff, 0x00, 0x00, 0x75, 0x10, 0x95, 0x01, 0x81, 0x02, 0x09, 0x35, 0x26, 0xff, 0x03, 0x46, 0xff, 0x03, 0x81, 0x02, 0x09, 0x32, 0x81, 0x02, 0x09, 0x31, 0x81, 0x02, 0x81, 0x03, 0x05, 0x09, 0x19, 0x01, 0x29, 0x0d, 0x25, 0x01, 0x45, 0x01, 0x75, 0x01, 0x95, 0x0d, 0x81, 0x02, 0x75, 0x0b, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01, 0x09, 0x39, 0x25, 0x07, 0x46, 0x3b, 0x01, 0x55, 0x00, 0x65, 0x14, 0x75, 0x04, 0x81, 0x42, 0x65, 0x00, 0x81, 0x03, 0x85, 0x0a, 0x06, 0x00, 0xff, 0x09, 0x0a, 0x75, 0x08, 0x95, 0x3f, 0x26, 0xff, 0x7f, 0x16, 0x00, 0x80, 0x46, 0xff, 0x7f, 0x36, 0x00, 0x80, 0x91, 0x02, 0x85, 0x02, 0x09, 0x02, 0x81, 0x02, 0x09, 0x14, 0x85, 0x14, 0x81, 0x02, 0xc0, 0xc0,}; +static __u8 t300rs_rdesc_fixed[] = {0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x85, 0x07, 0x09, 0x30, 0x15, 0x00, 0x27, 0xff, 0xff, 0x00, 0x00, 0x35, 0x00, 0x47, 0xff, 0xff, 0x00, 0x00, 0x75, 0x10, 0x95, 0x01, 0x81, 0x02, 0x09, 0x35, 0x26, 0xff, 0x03, 0x46, 0xff, 0x03, 0x81, 0x02, 0x09, 0x32, 0x81, 0x02, 0x09, 0x31, 0x81, 0x02, 0x81, 0x03, 0x05, 0x09, 0x19, 0x01, 0x29, 0x0d, 0x25, 0x01, 0x45, 0x01, 0x75, 0x01, 0x95, 0x0d, 0x81, 0x02, 0x75, 0x0b, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01, 0x09, 0x39, 0x25, 0x07, 0x46, 0x3b, 0x01, 0x55, 0x00, 0x65, 0x14, 0x75, 0x04, 0x81, 0x42, 0x65, 0x00, 0x81, 0x03, 0x85, 0x60, // here 0x0a + 0x06, 0x00, 0xff, 0x09, 0x60, // here 0x0a + 0x75, 0x08, 0x95, 0x3f, 0x26, 0xff, 0x7f, 0x16, 0x00, 0x80, 0x46, 0xff, 0x7f, 0x36, 0x00, 0x80, 0x91, 0x02, 0x85, 0x02, 0x09, 0x02, 0x81, 0x02, 0x09, 0x14, 0x85, 0x14, 0x81, 0x02, 0xc0, 0xc0,}; static u8 spring_values[] = { 0xa6, 0x6a, 0xa6, 0x6a, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xdf, 0x58, 0xa6, 0x6a, 0x06 |
