File: libusb.patch.txt

package info (click to toggle)
digitemp 3.7.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 852 kB
  • sloc: ansic: 7,254; perl: 644; makefile: 118; python: 67; sh: 39; sql: 11
file content (171 lines) | stat: -rw-r--r-- 3,198 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
--------------070507070300030101020103
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I've successfully used the driver found in main PDK archive 
(owpd300b2.zip) under generic library using usblnk.c and usbses.lnk. 
This driver in turn uses libusb library found on the internet.

I've found libusb v0.1.7, which contained a small bug in linux.c file. 
The fixed routine is below.

int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,
    int timeout)
{
  struct usb_bulktransfer bulk;
  int ret, retrieved = 0, requested;

  /* Ensure the endpoint address is correct */
  ep |= USB_ENDPOINT_IN;

  do {
    bulk.ep = ep;
    requested = size - retrieved;
    if (requested > MAX_READ_WRITE)
      requested = MAX_READ_WRITE;
    bulk.len = requested;
    bulk.timeout = timeout;
    bulk.data = (unsigned char *)bytes + retrieved;

    ret = ioctl(dev->fd, IOCTL_USB_BULK, &bulk);
    if (ret < 0)
      USB_ERROR_STR(ret, "error reading from bulk endpoint 0x%x: %s",
    ep, strerror(errno));

    retrieved += ret;
  } while (ret > 0 && retrieved < size); /* Yefim: && ret == requested */

  return retrieved;
}

Best regards,

Mike.

bcl wrote:

>On Wed, Jul 23, 2003 at 05:57:50AM -0400, Paul Alfille wrote:
>  
>
>>Has anyone written a driver for the DS9490 USB master for Linux?
>>
>>I will try if it hasn't been done, but it's not my area of expertise.
>>
>>    
>>
>
>Not yet (to my knowledge), although I am trying to make the time to get
>started on the project. 
>
>Brian
>
>  
>

--------------070507070300030101020103
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  
  

I've successfully used the driver found in main PDK archive (owpd300b2.zip)
under generic library using usblnk.c and usbses.lnk. This driver in turn
uses libusb library found on the internet.



I've found libusb v0.1.7, which contained a small bug in linux.c file. The
fixed routine is below.



int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,

    int timeout)

{

  struct usb_bulktransfer bulk;

  int ret, retrieved = 0, requested;



  /* Ensure the endpoint address is correct */

  ep |= USB_ENDPOINT_IN;



  do {

    bulk.ep = ep;

    requested = size - retrieved;

    if (requested > MAX_READ_WRITE)

      requested = MAX_READ_WRITE;

    bulk.len = requested;

    bulk.timeout = timeout;

    bulk.data = (unsigned char *)bytes + retrieved;



    ret = ioctl(dev->fd, IOCTL_USB_BULK, &bulk);

    if (ret < 0)

      USB_ERROR_STR(ret, "error reading from bulk endpoint 0x%x: %s",

    ep, strerror(errno));



    retrieved += ret;

  } while (ret > 0 && retrieved < size); /* Yefim: &&
ret == requested */



  return retrieved;

}



Best regards,



Mike.



bcl wrote:

>On Wed, Jul 23, 2003 at 05:57:50AM -0400, Paul Alfille wrote:
>  
>
>>Has anyone written a driver for the DS9490 USB master for Linux?
>>
>>I will try if it hasn't been done, but it's not my area of expertise.
>>
>>    
>>
>
>Not yet (to my knowledge), although I am trying to make the time to get
>started on the project. 
>
>Brian
>
>  
>