@@ -58,33 +58,25 @@ static inline void samsung_irda_dev_trace(struct hid_device *hdev,
58
58
static __u8 * samsung_irda_report_fixup (struct hid_device * hdev , __u8 * rdesc ,
59
59
unsigned int * rsize )
60
60
{
61
- if (* rsize == 184 && rdesc [175 ] == 0x25 && rdesc [176 ] == 0x40 &&
62
- rdesc [177 ] == 0x75 && rdesc [178 ] == 0x30 &&
63
- rdesc [179 ] == 0x95 && rdesc [180 ] == 0x01 &&
61
+ if (* rsize == 184 && !memcmp (& rdesc [175 ], "\x25\x40\x75\x30\x95\x01" , 6 ) &&
64
62
rdesc [182 ] == 0x40 ) {
65
63
samsung_irda_dev_trace (hdev , 184 );
66
64
rdesc [176 ] = 0xff ;
67
65
rdesc [178 ] = 0x08 ;
68
66
rdesc [180 ] = 0x06 ;
69
67
rdesc [182 ] = 0x42 ;
70
- } else
71
- if (* rsize == 203 && rdesc [192 ] == 0x15 && rdesc [193 ] == 0x0 &&
72
- rdesc [194 ] == 0x25 && rdesc [195 ] == 0x12 ) {
68
+ } else if (* rsize == 203 && !memcmp (& rdesc [192 ], "\x15\x00\x25\x12" , 4 )) {
73
69
samsung_irda_dev_trace (hdev , 203 );
74
- rdesc [193 ] = 0x1 ;
75
- rdesc [195 ] = 0xf ;
76
- } else
77
- if (* rsize == 135 && rdesc [124 ] == 0x15 && rdesc [125 ] == 0x0 &&
78
- rdesc [126 ] == 0x25 && rdesc [127 ] == 0x11 ) {
70
+ rdesc [193 ] = 0x01 ;
71
+ rdesc [195 ] = 0x0f ;
72
+ } else if (* rsize == 135 && !memcmp (& rdesc [124 ], "\x15\x00\x25\x11" , 4 )) {
79
73
samsung_irda_dev_trace (hdev , 135 );
80
- rdesc [125 ] = 0x1 ;
81
- rdesc [127 ] = 0xe ;
82
- } else
83
- if (* rsize == 171 && rdesc [160 ] == 0x15 && rdesc [161 ] == 0x0 &&
84
- rdesc [162 ] == 0x25 && rdesc [163 ] == 0x01 ) {
74
+ rdesc [125 ] = 0x01 ;
75
+ rdesc [127 ] = 0x0e ;
76
+ } else if (* rsize == 171 && !memcmp (& rdesc [160 ], "\x15\x00\x25\x01" , 4 )) {
85
77
samsung_irda_dev_trace (hdev , 171 );
86
- rdesc [161 ] = 0x1 ;
87
- rdesc [163 ] = 0x3 ;
78
+ rdesc [161 ] = 0x01 ;
79
+ rdesc [163 ] = 0x03 ;
88
80
}
89
81
return rdesc ;
90
82
}
@@ -99,25 +91,47 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev,
99
91
struct usb_interface * intf = to_usb_interface (hdev -> dev .parent );
100
92
unsigned short ifnum = intf -> cur_altsetting -> desc .bInterfaceNumber ;
101
93
102
- if (1 != ifnum || HID_UP_CONSUMER != (usage -> hid & HID_USAGE_PAGE ))
94
+ if (ifnum != 1 || HID_UP_CONSUMER != (usage -> hid & HID_USAGE_PAGE ))
103
95
return 0 ;
104
96
105
97
dbg_hid ("samsung wireless keyboard/mouse input mapping event [0x%x]\n" ,
106
98
usage -> hid & HID_USAGE );
107
99
108
100
switch (usage -> hid & HID_USAGE ) {
109
101
/* report 2 */
110
- case 0x183 : samsung_kbd_mouse_map_key_clear (KEY_MEDIA ); break ;
111
- case 0x195 : samsung_kbd_mouse_map_key_clear (KEY_EMAIL ); break ;
112
- case 0x196 : samsung_kbd_mouse_map_key_clear (KEY_CALC ); break ;
113
- case 0x197 : samsung_kbd_mouse_map_key_clear (KEY_COMPUTER ); break ;
114
- case 0x22b : samsung_kbd_mouse_map_key_clear (KEY_SEARCH ); break ;
115
- case 0x22c : samsung_kbd_mouse_map_key_clear (KEY_WWW ); break ;
116
- case 0x22d : samsung_kbd_mouse_map_key_clear (KEY_BACK ); break ;
117
- case 0x22e : samsung_kbd_mouse_map_key_clear (KEY_FORWARD ); break ;
118
- case 0x22f : samsung_kbd_mouse_map_key_clear (KEY_FAVORITES ); break ;
119
- case 0x230 : samsung_kbd_mouse_map_key_clear (KEY_REFRESH ); break ;
120
- case 0x231 : samsung_kbd_mouse_map_key_clear (KEY_STOP ); break ;
102
+ case 0x183 :
103
+ samsung_kbd_mouse_map_key_clear (KEY_MEDIA );
104
+ break ;
105
+ case 0x195 :
106
+ samsung_kbd_mouse_map_key_clear (KEY_EMAIL );
107
+ break ;
108
+ case 0x196 :
109
+ samsung_kbd_mouse_map_key_clear (KEY_CALC );
110
+ break ;
111
+ case 0x197 :
112
+ samsung_kbd_mouse_map_key_clear (KEY_COMPUTER );
113
+ break ;
114
+ case 0x22b :
115
+ samsung_kbd_mouse_map_key_clear (KEY_SEARCH );
116
+ break ;
117
+ case 0x22c :
118
+ samsung_kbd_mouse_map_key_clear (KEY_WWW );
119
+ break ;
120
+ case 0x22d :
121
+ samsung_kbd_mouse_map_key_clear (KEY_BACK );
122
+ break ;
123
+ case 0x22e :
124
+ samsung_kbd_mouse_map_key_clear (KEY_FORWARD );
125
+ break ;
126
+ case 0x22f :
127
+ samsung_kbd_mouse_map_key_clear (KEY_FAVORITES );
128
+ break ;
129
+ case 0x230 :
130
+ samsung_kbd_mouse_map_key_clear (KEY_REFRESH );
131
+ break ;
132
+ case 0x231 :
133
+ samsung_kbd_mouse_map_key_clear (KEY_STOP );
134
+ break ;
121
135
default :
122
136
return 0 ;
123
137
}
@@ -128,7 +142,7 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev,
128
142
static __u8 * samsung_report_fixup (struct hid_device * hdev , __u8 * rdesc ,
129
143
unsigned int * rsize )
130
144
{
131
- if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev -> product && hid_is_usb (hdev ))
145
+ if (hdev -> product == USB_DEVICE_ID_SAMSUNG_IR_REMOTE && hid_is_usb (hdev ))
132
146
rdesc = samsung_irda_report_fixup (hdev , rdesc , rsize );
133
147
return rdesc ;
134
148
}
@@ -139,7 +153,7 @@ static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi,
139
153
{
140
154
int ret = 0 ;
141
155
142
- if (USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE == hdev -> product && hid_is_usb (hdev ))
156
+ if (hdev -> product == USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE && hid_is_usb (hdev ))
143
157
ret = samsung_kbd_mouse_input_mapping (hdev ,
144
158
hi , field , usage , bit , max );
145
159
@@ -158,7 +172,7 @@ static int samsung_probe(struct hid_device *hdev,
158
172
goto err_free ;
159
173
}
160
174
161
- if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev -> product ) {
175
+ if (hdev -> product == USB_DEVICE_ID_SAMSUNG_IR_REMOTE ) {
162
176
if (!hid_is_usb (hdev )) {
163
177
ret = - EINVAL ;
164
178
goto err_free ;
0 commit comments