Skip to content

Commit 6a43678

Browse files
committed
Trim trailing spaces.
1 parent f40604d commit 6a43678

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/HID/HID.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ int HID_::getInterface(uint8_t* interfaceCount)
3939
return USB_SendControl(0, &hidInterface, sizeof(hidInterface));
4040
}
4141

42-
// Since this function is not exposed in USBCore API, had to replicate here.
42+
// Since this function is not exposed in USBCore API, had to replicate here.
4343
static bool USB_SendStringDescriptor(const char* string_P, u8 string_len, uint8_t flags) {
44-
44+
4545
u8 c[2] = {(u8)(2 + string_len * 2), 3};
4646

4747
USB_SendControl(0,&c,2);
@@ -60,12 +60,12 @@ static bool USB_SendStringDescriptor(const char* string_P, u8 string_len, uint8_
6060

6161
int HID_::getDescriptor(USBSetup& setup)
6262
{
63-
63+
6464
u8 t = setup.wValueH;
65-
65+
6666
// HID-specific strings
6767
if(USB_STRING_DESCRIPTOR_TYPE == t) {
68-
68+
6969
// we place all strings in the 0xFF00-0xFFFE range
7070
HIDReport* rep = GetFeature(0xFF00 | setup.wValueL );
7171
if(rep) {
@@ -75,7 +75,7 @@ int HID_::getDescriptor(USBSetup& setup)
7575
return 0;
7676
}
7777
}
78-
78+
7979
// Check if this is a HID Class Descriptor request
8080
if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; }
8181
if (HID_REPORT_DESCRIPTOR_TYPE != t) { return 0; }
@@ -91,11 +91,11 @@ int HID_::getDescriptor(USBSetup& setup)
9191
return -1;
9292
total += res;
9393
}
94-
94+
9595
// Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol
9696
// due to the USB specs, but Windows and Linux just assumes its in report mode.
9797
protocol = HID_REPORT_PROTOCOL;
98-
98+
9999
return total;
100100
}
101101

@@ -108,9 +108,9 @@ uint8_t HID_::getShortName(char *name)
108108
return strlen_P(serial);
109109
}
110110
else {
111-
111+
112112
// default serial number
113-
113+
114114
name[0] = 'H';
115115
name[1] = 'I';
116116
name[2] = 'D';
@@ -153,7 +153,7 @@ int HID_::SetFeature(uint16_t id, const void* data, int len)
153153
}
154154

155155
}
156-
156+
157157
reportCount++;
158158
return reportCount;
159159
}
@@ -194,31 +194,31 @@ HIDReport* HID_::GetFeature(uint16_t id)
194194
}
195195

196196
bool HID_::setup(USBSetup& setup)
197-
{
197+
{
198198
if (pluggedInterface != setup.wIndex) {
199199
return false;
200200
}
201201

202202
uint8_t request = setup.bRequest;
203203
uint8_t requestType = setup.bmRequestType;
204-
204+
205205
if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE)
206-
{
206+
{
207207
if (request == HID_GET_REPORT) {
208208

209209
if(setup.wValueH == HID_REPORT_TYPE_FEATURE)
210210
{
211211

212212
HIDReport* current = GetFeature(setup.wValueL);
213-
if(current){
213+
if(current){
214214
if(USB_SendControl(0, &(current->id), 1)>0 &&
215215
USB_SendControl(0, current->data, current->length)>0)
216216
return true;
217217
}
218218

219219
return false;
220-
221-
}
220+
221+
}
222222
return true;
223223
}
224224
if (request == HID_GET_PROTOCOL) {
@@ -231,7 +231,7 @@ bool HID_::setup(USBSetup& setup)
231231
}
232232

233233
if (requestType == REQUEST_HOSTTODEVICE_CLASS_INTERFACE)
234-
{
234+
{
235235
if (request == HID_SET_PROTOCOL) {
236236
// The USB Host tells us if we are in boot or report mode.
237237
// This only works with a real boot compatible device.
@@ -248,15 +248,15 @@ bool HID_::setup(USBSetup& setup)
248248
{
249249

250250
HIDReport* current = GetFeature(setup.wValueL);
251-
if(!current) return false;
252-
if(setup.wLength != current->length + 1) return false;
253-
uint8_t* data = new uint8_t[setup.wLength];
254-
USB_RecvControl(data, setup.wLength);
255-
if(*data != current->id) return false;
256-
memcpy((uint8_t*)current->data, data+1, current->length);
257-
delete[] data;
251+
if(!current) return false;
252+
if(setup.wLength != current->length + 1) return false;
253+
uint8_t* data = new uint8_t[setup.wLength];
254+
USB_RecvControl(data, setup.wLength);
255+
if(*data != current->id) return false;
256+
memcpy((uint8_t*)current->data, data+1, current->length);
257+
delete[] data;
258258
return true;
259-
259+
260260
}
261261

262262
}

0 commit comments

Comments
 (0)