~ubuntu-branches/debian/jessie/digitemp/jessie

« back to all changes in this revision

Viewing changes to contrib/libusb.patch.txt

  • Committer: Bazaar Package Importer
  • Author(s): Jesus Roncero
  • Date: 2004-09-01 01:34:37 UTC
  • Revision ID: james.westby@ubuntu.com-20040901013437-eicsrrd40dr371u0
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--------------070507070300030101020103
 
2
Content-Type: text/plain; charset=us-ascii; format=flowed
 
3
Content-Transfer-Encoding: 7bit
 
4
 
 
5
I've successfully used the driver found in main PDK archive 
 
6
(owpd300b2.zip) under generic library using usblnk.c and usbses.lnk. 
 
7
This driver in turn uses libusb library found on the internet.
 
8
 
 
9
I've found libusb v0.1.7, which contained a small bug in linux.c file. 
 
10
The fixed routine is below.
 
11
 
 
12
int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,
 
13
    int timeout)
 
14
{
 
15
  struct usb_bulktransfer bulk;
 
16
  int ret, retrieved = 0, requested;
 
17
 
 
18
  /* Ensure the endpoint address is correct */
 
19
  ep |= USB_ENDPOINT_IN;
 
20
 
 
21
  do {
 
22
    bulk.ep = ep;
 
23
    requested = size - retrieved;
 
24
    if (requested > MAX_READ_WRITE)
 
25
      requested = MAX_READ_WRITE;
 
26
    bulk.len = requested;
 
27
    bulk.timeout = timeout;
 
28
    bulk.data = (unsigned char *)bytes + retrieved;
 
29
 
 
30
    ret = ioctl(dev->fd, IOCTL_USB_BULK, &bulk);
 
31
    if (ret < 0)
 
32
      USB_ERROR_STR(ret, "error reading from bulk endpoint 0x%x: %s",
 
33
    ep, strerror(errno));
 
34
 
 
35
    retrieved += ret;
 
36
  } while (ret > 0 && retrieved < size); /* Yefim: && ret == requested */
 
37
 
 
38
  return retrieved;
 
39
}
 
40
 
 
41
Best regards,
 
42
 
 
43
Mike.
 
44
 
 
45
bcl wrote:
 
46
 
 
47
>On Wed, Jul 23, 2003 at 05:57:50AM -0400, Paul Alfille wrote:
 
48
>  
 
49
>
 
50
>>Has anyone written a driver for the DS9490 USB master for Linux?
 
51
>>
 
52
>>I will try if it hasn't been done, but it's not my area of expertise.
 
53
>>
 
54
>>    
 
55
>>
 
56
>
 
57
>Not yet (to my knowledge), although I am trying to make the time to get
 
58
>started on the project. 
 
59
>
 
60
>Brian
 
61
>
 
62
>  
 
63
>
 
64
 
 
65
--------------070507070300030101020103
 
66
Content-Type: text/html; charset=us-ascii
 
67
Content-Transfer-Encoding: 7bit
 
68
 
 
69
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
70
 
 
71
  
 
72
  
 
73
 
 
74
I've successfully used the driver found in main PDK archive (owpd300b2.zip)
 
75
under generic library using usblnk.c and usbses.lnk. This driver in turn
 
76
uses libusb library found on the internet.
 
77
 
 
78
 
 
79
 
 
80
I've found libusb v0.1.7, which contained a small bug in linux.c file. The
 
81
fixed routine is below.
 
82
 
 
83
 
 
84
 
 
85
int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,
 
86
 
 
87
    int timeout)
 
88
 
 
89
{
 
90
 
 
91
  struct usb_bulktransfer bulk;
 
92
 
 
93
  int ret, retrieved = 0, requested;
 
94
 
 
95
 
 
96
 
 
97
  /* Ensure the endpoint address is correct */
 
98
 
 
99
  ep |= USB_ENDPOINT_IN;
 
100
 
 
101
 
 
102
 
 
103
  do {
 
104
 
 
105
    bulk.ep = ep;
 
106
 
 
107
    requested = size - retrieved;
 
108
 
 
109
    if (requested > MAX_READ_WRITE)
 
110
 
 
111
      requested = MAX_READ_WRITE;
 
112
 
 
113
    bulk.len = requested;
 
114
 
 
115
    bulk.timeout = timeout;
 
116
 
 
117
    bulk.data = (unsigned char *)bytes + retrieved;
 
118
 
 
119
 
 
120
 
 
121
    ret = ioctl(dev->fd, IOCTL_USB_BULK, &bulk);
 
122
 
 
123
    if (ret < 0)
 
124
 
 
125
      USB_ERROR_STR(ret, "error reading from bulk endpoint 0x%x: %s",
 
126
 
 
127
    ep, strerror(errno));
 
128
 
 
129
 
 
130
 
 
131
    retrieved += ret;
 
132
 
 
133
  } while (ret > 0 && retrieved < size); /* Yefim: &&
 
134
ret == requested */
 
135
 
 
136
 
 
137
 
 
138
  return retrieved;
 
139
 
 
140
}
 
141
 
 
142
 
 
143
 
 
144
Best regards,
 
145
 
 
146
 
 
147
 
 
148
Mike.
 
149
 
 
150
 
 
151
 
 
152
bcl wrote:
 
153
 
 
154
>On Wed, Jul 23, 2003 at 05:57:50AM -0400, Paul Alfille wrote:
 
155
>  
 
156
>
 
157
>>Has anyone written a driver for the DS9490 USB master for Linux?
 
158
>>
 
159
>>I will try if it hasn't been done, but it's not my area of expertise.
 
160
>>
 
161
>>    
 
162
>>
 
163
>
 
164
>Not yet (to my knowledge), although I am trying to make the time to get
 
165
>started on the project. 
 
166
>
 
167
>Brian
 
168
>
 
169
>  
 
170
>
 
171