return LIBUSB_ERROR_NOT_FOUND;
val = ep->wMaxPacketSize;
- ep_type = ep->bmAttributes & 0x3;
+ ep_type = (enum libusb_transfer_type) (ep->bmAttributes & 0x3);
libusb_free_config_descriptor(config);
r = val & 0x07ff;
*/
int API_EXPORTED libusb_has_capability(uint32_t capability)
{
- enum libusb_capability cap = capability;
- switch (cap) {
+ switch (capability) {
case LIBUSB_CAP_HAS_CAPABILITY:
return 1;
}
*/
DEFAULT_VISIBILITY const char * LIBUSB_CALL libusb_error_name(int error_code)
{
- enum libusb_error error = error_code;
- switch (error) {
+ switch (error_code) {
case LIBUSB_SUCCESS:
return "LIBUSB_SUCCESS";
case LIBUSB_ERROR_IO:
return "LIBUSB_ERROR_NOT_SUPPORTED";
case LIBUSB_ERROR_OTHER:
return "LIBUSB_ERROR_OTHER";
+ default:
+ return "**UNKNOWN**";
}
- return "**UNKNOWN**";
}
/** \ingroup misc
error_code = retval?retval:GetLastError();
- safe_sprintf(err_string, ERR_BUFFER_SIZE, "[%d] ", error_code);
+ safe_sprintf(err_string, ERR_BUFFER_SIZE, "[%u] ", error_code);
size = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &err_string[safe_strlen(err_string)],
return 0;
}
}
- usbi_dbg("ERROR: broken timer thread");
- return 1;
}
static int windows_clock_gettime(int clk_id, struct timespec *tp)
size[0] = capabilities.NumberInputValueCaps;
size[1] = capabilities.NumberOutputValueCaps;
size[2] = capabilities.NumberFeatureValueCaps;
- for (j=0; j<3; j++) {
+ for (j=HidP_Input; j<=HidP_Feature; j++) {
usbi_dbg("%d HID %s report value(s) found", size[j], type[j]);
priv->hid->uses_report_ids[j] = false;
if (size[j] > 0) {
value_caps = (HIDP_VALUE_CAPS*) calloc(size[j], sizeof(HIDP_VALUE_CAPS));
if ( (value_caps != NULL)
- && (HidP_GetValueCaps(j, value_caps, &size[j], preparsed_data) == HIDP_STATUS_SUCCESS)
+ && (HidP_GetValueCaps((HIDP_REPORT_TYPE)j, value_caps, &size[j], preparsed_data) == HIDP_STATUS_SUCCESS)
&& (size[j] >= 1) ) {
nb_ids[0] = 0;
nb_ids[1] = 0;