Ticket #7629: joystickpatch.diff
File joystickpatch.diff, 2.3 KB (added by , 13 years ago) |
---|
-
src/add-ons/kernel/drivers/input/usb_hid/JoystickProtocolHandler.cpp
136 136 if (*numBytes < sizeof(extended_joystick)) 137 137 return B_BUFFER_OVERFLOW; 138 138 139 while(RingBufferReadable() == 0) {139 if(RingBufferReadable() == 0) { 140 140 status_t result = _ReadReport(); 141 141 if (result != B_OK) 142 142 return result; … … 209 209 status_t 210 210 JoystickProtocolHandler::_ReadReport() 211 211 { 212 status_t result = fReport.WaitForReport( B_INFINITE_TIMEOUT);212 status_t result = fReport.WaitForReport(0); 213 213 if (result != B_OK) { 214 214 if (fReport.Device()->IsRemoved()) { 215 215 TRACE("device has been removed\n"); … … 223 223 } 224 224 225 225 // signal that we simply want to try again 226 return B_OK;226 if(result != B_TIMED_OUT) return B_OK; 227 227 } 228 228 229 229 extended_joystick info; … … 246 246 info.buttons |= (button->Data() & 1) << (button->UsageID() - 1); 247 247 } 248 248 249 fReport.DoneProcessing();249 if(result != B_TIMED_OUT) fReport.DoneProcessing(); 250 250 TRACE("got joystick report\n"); 251 251 252 252 info.timestamp = system_time(); -
src/kits/device/Joystick.cpp
58 58 59 59 fBeBoxMode(false), 60 60 fFD(-1), 61 fDevices( new(std::nothrow) BList),61 fDevices(NULL), 62 62 fJoystickInfo(new(std::nothrow) joystick_info), 63 63 fExtendedJoystick(new(std::nothrow) BList) 64 64 { … … 187 187 BJoystick::ScanDevices(bool useDisabled) 188 188 { 189 189 CALLED(); 190 if(fDevices == NULL) fDevices = new(std::nothrow) BList; 190 191 if (useDisabled) { 191 192 _BJoystickTweaker joystickTweaker(*this); 192 193 joystickTweaker.scan_including_disabled(); … … 200 201 CALLED(); 201 202 202 203 // Refresh devices list 203 ScanDevices(true);204 if(fDevices == NULL) ScanDevices(true); 204 205 205 206 int32 count = 0; 206 207 if (fDevices != NULL) … … 215 216 BJoystick::GetDeviceName(int32 index, char *name, size_t bufSize) 216 217 { 217 218 CALLED(); 218 if (fDevices == NULL) 219 return B_NO_INIT; 219 //if (fDevices == NULL) 220 //return B_NO_INIT; 221 if(fDevices == NULL) ScanDevices(true); 220 222 221 223 if (index >= fDevices->CountItems()) 222 224 return B_BAD_INDEX;