teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

コード誤り、修正

2021/03/18 00:00

投稿

abc123abc
abc123abc

スコア1

title CHANGED
File without changes
body CHANGED
@@ -23,7 +23,7 @@
23
23
  int actual;
24
24
  int request = LIBUSB_ENDPOINT_IN | EP2;
25
25
 
26
- ret = libusb_bulk_transfer(s_handle, request, buf, size, actual, TIMEOUT);
26
+ ret = libusb_bulk_transfer(s_handle, request, buf, sizeof(buf), &actual, 1000);
27
27
  ★LIBUSB_ERROR_TIMEOUTが返ってくる★
28
28
  return ret;
29
29
  }
@@ -31,13 +31,11 @@
31
31
  int function2()
32
32
  {
33
33
  int ret;
34
- QString str;
35
- QString str_1;
36
34
  int actual;
37
35
  int request = LIBUSB_ENDPOINT_OUT | EP1;
38
36
  unsigned char buf[64];
39
37
 
40
- ret = libusb_bulk_transfer(s_handle, request, buf, size, actual, TIMEOUT);
38
+ ret = libusb_bulk_transfer(s_handle, request, buf, size, &actual, 1000);
41
39
  return ret;
42
40
  }
43
41
 
@@ -53,7 +51,7 @@
53
51
  uint16_t wIndex = 0;
54
52
  uint16_t wLength = 1;
55
53
 
56
- ret = libusb_control_transfer(s_handle,bmRequestType, bRequest, wValue, wIndex, buf, wLength, TIMEOUT);
54
+ ret = libusb_control_transfer(s_handle,bmRequestType, bRequest, wValue, wIndex, buf, wLength, 1000);
57
55
  return ret;
58
56
  }
59
57
  /* コントロール転送 送信 */
@@ -68,7 +66,7 @@
68
66
  uint16_t wIndex = 0;
69
67
  uint16_t wLength = 8;
70
68
 
71
- ret = libusb_control_transfer(s_handle,bmRequestType, bRequest, wValue, wIndex, buf, wLength, TIMEOUT);
69
+ ret = libusb_control_transfer(s_handle,bmRequestType, bRequest, wValue, wIndex, buf, wLength, 1000);
72
70
  return ret;
73
71
  }
74
72