1 |
commit: 5215dc3f8f5a82ad1944687213e123bad88ec1a5 |
2 |
Author: David Seifert <soap <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 16 18:18:09 2020 +0000 |
4 |
Commit: David Seifert <soap <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 16 18:18:09 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5215dc3f |
7 |
|
8 |
dev-embedded/smdk-dltool: Remove old 0.20-r3 |
9 |
|
10 |
Package-Manager: Portage-3.0.7, Repoman-3.0.1 |
11 |
Signed-off-by: David Seifert <soap <AT> gentoo.org> |
12 |
|
13 |
.../files/smdk-dltool-0.20-libusb-1.0.patch | 338 --------------------- |
14 |
.../smdk-dltool/smdk-dltool-0.20-r3.ebuild | 34 --- |
15 |
2 files changed, 372 deletions(-) |
16 |
|
17 |
diff --git a/dev-embedded/smdk-dltool/files/smdk-dltool-0.20-libusb-1.0.patch b/dev-embedded/smdk-dltool/files/smdk-dltool-0.20-libusb-1.0.patch |
18 |
deleted file mode 100644 |
19 |
index 889a439c7fb..00000000000 |
20 |
--- a/dev-embedded/smdk-dltool/files/smdk-dltool-0.20-libusb-1.0.patch |
21 |
+++ /dev/null |
22 |
@@ -1,338 +0,0 @@ |
23 |
-migrate to libusb-1 by me (Mike Frysinger) |
24 |
- |
25 |
---- a/Makefile |
26 |
-+++ b/Makefile |
27 |
-@@ -10,8 +10,8 @@ |
28 |
- CFLAGS ?= -O2 -g |
29 |
- CFLAGS += -Wall |
30 |
- PKG_CONFIG ?= pkg-config |
31 |
--CPPFLAGS += $(shell $(PKG_CONFIG) --cflags libusb) |
32 |
--LDLIBS = $(shell $(PKG_CONFIG) --libs libusb) |
33 |
-+CPPFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0) |
34 |
-+LDLIBS = $(shell $(PKG_CONFIG) --libs libusb-1.0) |
35 |
- |
36 |
- all: dltool |
37 |
- |
38 |
---- a/dltool.c |
39 |
-+++ b/dltool.c |
40 |
-@@ -13,9 +13,11 @@ |
41 |
- #include <stdio.h> |
42 |
- #include <getopt.h> |
43 |
- #include <fcntl.h> |
44 |
-+#include <errno.h> |
45 |
-+#include <unistd.h> |
46 |
- |
47 |
- |
48 |
--#include <usb.h> |
49 |
-+#include <libusb.h> |
50 |
- |
51 |
- unsigned int debug = 0; |
52 |
- unsigned long dl_addr = 0x30000000L; |
53 |
-@@ -23,12 +25,22 @@ unsigned long dl_size = 0L; |
54 |
- unsigned char *dl_data = NULL; |
55 |
- |
56 |
- char *dl_file = "download.dat"; |
57 |
--char *dl_udev = NULL; |
58 |
--char *dl_ubus = NULL; |
59 |
-+libusb_context *ctx = NULL; |
60 |
-+libusb_device_handle *devh = NULL; |
61 |
- |
62 |
- int ep_out = 0; |
63 |
- |
64 |
- #define DBG(x) if (debug) { printf x; } |
65 |
-+#define err(fmt, args...) \ |
66 |
-+ do { \ |
67 |
-+ if (devh) \ |
68 |
-+ libusb_close(devh); \ |
69 |
-+ if (ctx) \ |
70 |
-+ libusb_exit(ctx); \ |
71 |
-+ fprintf(stderr, "dltool: " fmt "\n", ## args); \ |
72 |
-+ exit(1); \ |
73 |
-+ } while (0) |
74 |
-+#define errp(fmt, args...) err(fmt ": %s", ## args, strerror(errno)) |
75 |
- |
76 |
- void write_u32(unsigned char *dp, unsigned long val) |
77 |
- { |
78 |
-@@ -108,25 +120,30 @@ void calc_cksum(unsigned char *data, ssize_t len) |
79 |
- cp[1] = cksum >> 8; |
80 |
- } |
81 |
- |
82 |
--int verify_device(struct usb_device *dev) |
83 |
-+int verify_device(libusb_device *dev) |
84 |
- { |
85 |
-+ struct libusb_device_descriptor desc; |
86 |
-+ |
87 |
-+ if (libusb_get_device_descriptor(dev, &desc)) |
88 |
-+ return 0; |
89 |
-+ |
90 |
- DBG(("dev %p: configurations %d\n", |
91 |
-- dev, dev->descriptor.bNumConfigurations)); |
92 |
-+ dev, desc.bNumConfigurations)); |
93 |
- |
94 |
-- if (dev->descriptor.bNumConfigurations != 1) |
95 |
-+ if (desc.bNumConfigurations != 1) |
96 |
- return 0; |
97 |
- |
98 |
-- DBG(("\t=> bLength %d\n", dev->descriptor.bLength)); |
99 |
-- DBG(("\t=> bType %d\n", dev->descriptor.bDescriptorType)); |
100 |
-- DBG(("\t=> bcdUSB %x\n", dev->descriptor.bcdUSB)); |
101 |
-- DBG(("\t=> idVendor %x\n", dev->descriptor.idVendor)); |
102 |
-- DBG(("\t=> idProduct %x\n", dev->descriptor.idProduct)); |
103 |
-+ DBG(("\t=> bLength %d\n", desc.bLength)); |
104 |
-+ DBG(("\t=> bType %d\n", desc.bDescriptorType)); |
105 |
-+ DBG(("\t=> bcdUSB %x\n", desc.bcdUSB)); |
106 |
-+ DBG(("\t=> idVendor %x\n", desc.idVendor)); |
107 |
-+ DBG(("\t=> idProduct %x\n", desc.idProduct)); |
108 |
- |
109 |
-- if (dev->descriptor.idVendor == 0x5345 && dev->descriptor.idProduct == 0x1234) { |
110 |
-+ if (desc.idVendor == 0x5345 && desc.idProduct == 0x1234) { |
111 |
- ep_out = 3; |
112 |
- return 1; |
113 |
- } |
114 |
-- else if(dev->descriptor.idVendor == 0x4e8 && dev->descriptor.idProduct == 0x1234){ |
115 |
-+ else if(desc.idVendor == 0x4e8 && desc.idProduct == 0x1234){ |
116 |
- printf("S3C64XX Detected!\n"); |
117 |
- ep_out = 2; |
118 |
- return 1; |
119 |
-@@ -173,6 +190,12 @@ struct option long_opts[] = { |
120 |
- .val = 'x', |
121 |
- }, |
122 |
- { |
123 |
-+ .name = "help", |
124 |
-+ .has_arg = 0, |
125 |
-+ .flag = NULL, |
126 |
-+ .val = 'h', |
127 |
-+ }, |
128 |
-+ { |
129 |
- .name = NULL |
130 |
- } |
131 |
- }; |
132 |
-@@ -181,12 +204,14 @@ int flg_show = 0; |
133 |
- |
134 |
- int main(int argc, char **argv) |
135 |
- { |
136 |
-- struct usb_bus *bus, *busp; |
137 |
-- struct usb_device *result = NULL; |
138 |
-- struct usb_device *found = NULL; |
139 |
-+ ssize_t num_devs, i; |
140 |
-+ libusb_device **list; |
141 |
-+ libusb_device *found; |
142 |
-+ int dl_ubus = -1; |
143 |
-+ int dl_udev = -1; |
144 |
-+ uint8_t bus_num, dev_num; |
145 |
- unsigned long fsize; |
146 |
-- usb_dev_handle *devh; |
147 |
-- int ret; |
148 |
-+ int ret, transferred; |
149 |
- |
150 |
- printf("SMDK42XX,S3C64XX USB Download Tool\n"); |
151 |
- printf("Version 0.20 (c) 2004,2005,2006" |
152 |
-@@ -197,7 +222,7 @@ int main(int argc, char **argv) |
153 |
- int index = 0; |
154 |
- int c; |
155 |
- |
156 |
-- c = getopt_long(argc, argv, "a:b:d:f:s", long_opts, &index); |
157 |
-+ c = getopt_long(argc, argv, "a:b:d:f:shx", long_opts, &index); |
158 |
- |
159 |
- DBG(("option index %d\n",c )); |
160 |
- |
161 |
-@@ -218,117 +243,127 @@ int main(int argc, char **argv) |
162 |
- break; |
163 |
- |
164 |
- case 'b': |
165 |
-- dl_ubus = optarg; |
166 |
-+ dl_ubus = atoi(optarg); |
167 |
- break; |
168 |
- |
169 |
- case 'd': |
170 |
-- dl_udev = optarg; |
171 |
-+ dl_udev = atoi(optarg); |
172 |
- break; |
173 |
- |
174 |
- case 'x': |
175 |
- debug = 1; |
176 |
-+ break; |
177 |
-+ |
178 |
-+ case 'h': |
179 |
-+ puts( |
180 |
-+ "Usage: dltool [options]\n" |
181 |
-+ "\n" |
182 |
-+ "-a <download addr>\n" |
183 |
-+ "-b <bus #>\n" |
184 |
-+ "-d <dev #>\n" |
185 |
-+ "-f <file>\n" |
186 |
-+ "-s Show found devices\n" |
187 |
-+ "-x Enable debug\n" |
188 |
-+ ); |
189 |
-+ return 0; |
190 |
- } |
191 |
- } |
192 |
- |
193 |
-- usb_init(); |
194 |
-- usb_find_busses(); |
195 |
-- usb_find_devices(); |
196 |
-- |
197 |
-- bus = usb_get_busses(); |
198 |
-- |
199 |
-- DBG(("usb_get_busses: %p\n", bus)); |
200 |
-- |
201 |
-- for (busp = bus; busp != NULL; busp = busp->next) { |
202 |
-- struct usb_device *dev; |
203 |
-- |
204 |
-- DBG(("bus %p: dirname %s\n", busp, busp->dirname)); |
205 |
-- |
206 |
-- if (dl_ubus) { |
207 |
-- if (strcmp(busp->dirname, dl_ubus) != 0) |
208 |
-- continue; |
209 |
-+ ret = libusb_init(&ctx); |
210 |
-+ if (ret) |
211 |
-+ errp("could not initialize usb stack"); |
212 |
-+ |
213 |
-+ bus_num = dev_num = 0; |
214 |
-+ found = NULL; |
215 |
-+ num_devs = libusb_get_device_list(ctx, &list); |
216 |
-+ for (i = 0; i < num_devs; ++i) { |
217 |
-+ libusb_device *dev = list[i]; |
218 |
-+ bus_num = libusb_get_bus_number(dev); |
219 |
-+ dev_num = libusb_get_device_address(dev); |
220 |
-+ |
221 |
-+ DBG(("bus %u; dev %u (%p)\n", bus_num, dev_num, dev)); |
222 |
-+ |
223 |
-+ if (dl_ubus >= 0 && bus_num != dl_ubus) |
224 |
-+ continue; |
225 |
-+ |
226 |
-+ if (!verify_device(dev)) |
227 |
-+ continue; |
228 |
-+ |
229 |
-+ if (flg_show) { |
230 |
-+ printf("bus %u: device %u\n", bus_num, dev_num); |
231 |
-+ continue; |
232 |
- } |
233 |
- |
234 |
-- for (dev = busp->devices; dev != NULL; dev = dev->next) { |
235 |
-- DBG(("dev %p filename %s\n", dev, dev->filename)); |
236 |
-+ if (dl_udev >= 0 && dev_num != dl_udev) |
237 |
-+ continue; |
238 |
- |
239 |
-- if (!verify_device(dev)) |
240 |
-- continue; |
241 |
-- |
242 |
-- if (flg_show) { |
243 |
-- printf("bus %s: device %s\n", |
244 |
-- busp->dirname, dev->filename); |
245 |
-- continue; |
246 |
-- } |
247 |
-- |
248 |
-- found = dev; |
249 |
-- |
250 |
-- if (dl_udev) { |
251 |
-- if (strcmp(dev->filename, dl_udev) == 0) { |
252 |
-- result = dev; |
253 |
-- break; |
254 |
-- } |
255 |
-- } |
256 |
-- } |
257 |
-- |
258 |
-- if (result != NULL) |
259 |
-- break; |
260 |
-+ found = dev; |
261 |
-+ break; |
262 |
- } |
263 |
- |
264 |
- if (flg_show) |
265 |
- return 0; |
266 |
- |
267 |
-- DBG(("device %p, found %p\n", result, found)); |
268 |
-+ DBG(("found %p\n", found)); |
269 |
- |
270 |
-- if (result == NULL && found != NULL) |
271 |
-- result = found; |
272 |
-- |
273 |
-- if (result == NULL) { |
274 |
-- fprintf(stderr, "failed to find device\n"); |
275 |
-- return 1; |
276 |
-- } |
277 |
-+ if (found == NULL) |
278 |
-+ err("failed to find device\n"); |
279 |
- |
280 |
-- printf("=> found device: bus %s, dev %s\n", |
281 |
-- result->bus->dirname, result->filename); |
282 |
-+ printf("=> found device: bus %u, dev %u\n", |
283 |
-+ bus_num, dev_num); |
284 |
- |
285 |
- dl_data = load_file(dl_file, &dl_size, &fsize); |
286 |
-- if (dl_data == NULL) { |
287 |
-- printf("failed to load %s\n", dl_file); |
288 |
-- return 1; |
289 |
-- } |
290 |
-+ if (dl_data == NULL) |
291 |
-+ errp("failed to load %s", dl_file); |
292 |
- |
293 |
- printf("=> loaded %ld bytes from %s\n", fsize, dl_file); |
294 |
- |
295 |
-- devh = usb_open(result); |
296 |
-- if (devh == NULL) { |
297 |
-- perror("usb_open"); |
298 |
-- return 1; |
299 |
-- } |
300 |
-+ ret = libusb_open(found, &devh); |
301 |
-+ if (ret == 0) { |
302 |
-+ /* |
303 |
-+ * Seems to break some recovery modes :( |
304 |
-+ * http://crosbug.com/26083 |
305 |
-+ * These fail: |
306 |
-+ * smdk-dltool -a 0x02021400 -f bl1.bin |
307 |
-+ * smdk-dltool -a 0x02023400 -f bl2.bin |
308 |
-+ */ |
309 |
-+#if 0 |
310 |
-+ uint8_t configuration; |
311 |
-+ struct libusb_config_descriptor *config; |
312 |
-+ libusb_get_active_config_descriptor(found, &config); |
313 |
-+ configuration = config->bConfigurationValue; |
314 |
-+ libusb_free_config_descriptor(config); |
315 |
-+ libusb_set_configuration(devh, configuration); |
316 |
-+#endif |
317 |
-+ } else |
318 |
-+ errp("libusb_open"); |
319 |
- |
320 |
- DBG(("claim interface\n")); |
321 |
- |
322 |
-- if (usb_claim_interface(devh, 0) < 0) { |
323 |
-- perror("usb_claim_interface"); |
324 |
-- usb_close(devh); |
325 |
-- return 1; |
326 |
-- } |
327 |
-+ ret = libusb_claim_interface(devh, 0); |
328 |
-+ if (ret) |
329 |
-+ errp("libusb_claim_interface"); |
330 |
- |
331 |
- printf("=> Downloading %ld bytes to 0x%08lx\n", dl_size, dl_addr); |
332 |
- |
333 |
- write_header(dl_data, dl_addr, dl_size); |
334 |
- calc_cksum(dl_data, dl_size); |
335 |
- |
336 |
-- //ret = usb_bulk_write(devh, 3, (void *)dl_data, dl_size, 5*1000*1000); |
337 |
-- ret = usb_bulk_write(devh, ep_out, (void *)dl_data, dl_size, 5*1000*1000); |
338 |
-+ //ret = libusb_bulk_transfer(devh, 3, dl_data, dl_size, &transferred, 5*1000*1000); |
339 |
-+ ret = libusb_bulk_transfer(devh, ep_out, dl_data, dl_size, &transferred, 5*1000*1000); |
340 |
- printf("=> usb_bulk_write() returned %d\n", ret); |
341 |
- |
342 |
-- if (ret != dl_size) { |
343 |
-- printf("failed to write %ld bytes\n", dl_size); |
344 |
-+ if (ret || transferred != dl_size) { |
345 |
-+ printf("failed to write %ld bytes (wrote %d): %s\n", |
346 |
-+ dl_size, transferred, strerror(errno)); |
347 |
-+ ret = 1; |
348 |
- } |
349 |
- |
350 |
- free(dl_data); |
351 |
- |
352 |
-- usb_release_interface(devh, 0); |
353 |
-- usb_close(devh); |
354 |
-+ libusb_release_interface(devh, 0); |
355 |
-+ libusb_close(devh); |
356 |
-+ libusb_exit(ctx); |
357 |
- |
358 |
-- return 0; |
359 |
-+ return ret; |
360 |
- } |
361 |
|
362 |
diff --git a/dev-embedded/smdk-dltool/smdk-dltool-0.20-r3.ebuild b/dev-embedded/smdk-dltool/smdk-dltool-0.20-r3.ebuild |
363 |
deleted file mode 100644 |
364 |
index d15dedcb728..00000000000 |
365 |
--- a/dev-embedded/smdk-dltool/smdk-dltool-0.20-r3.ebuild |
366 |
+++ /dev/null |
367 |
@@ -1,34 +0,0 @@ |
368 |
-# Copyright 1999-2014 Gentoo Foundation |
369 |
-# Distributed under the terms of the GNU General Public License v2 |
370 |
- |
371 |
-EAPI="4" |
372 |
- |
373 |
-inherit toolchain-funcs eutils |
374 |
- |
375 |
-DESCRIPTION="Tool to communicate with Samsung SMDK boards" |
376 |
-HOMEPAGE="http://www.fluff.org/ben/smdk/tools/" |
377 |
-SRC_URI="http://www.fluff.org/ben/smdk/tools/downloads/smdk-tools-v${PV}.tar.gz" |
378 |
- |
379 |
-# Email sent to author on 2012-01-18 querying about license |
380 |
-LICENSE="all-rights-reserved" |
381 |
-SLOT="0" |
382 |
-KEYWORDS="~amd64 ~x86" |
383 |
-IUSE="" |
384 |
-RESTRICT="mirror bindist" |
385 |
- |
386 |
-RDEPEND="virtual/libusb:1" |
387 |
-DEPEND="${RDEPEND}" |
388 |
- |
389 |
-S=${WORKDIR}/releases/smdk-tools-v${PV}/dltool |
390 |
- |
391 |
-src_prepare() { |
392 |
- epatch "${FILESDIR}"/${P}-add-S3C64xx-support.patch |
393 |
- epatch "${FILESDIR}"/${P}-build.patch |
394 |
- epatch "${FILESDIR}"/${P}-libusb-1.0.patch |
395 |
- tc-export CC PKG_CONFIG |
396 |
-} |
397 |
- |
398 |
-src_install() { |
399 |
- newbin dltool smdk-usbdl |
400 |
- dodoc readme.txt |
401 |
-} |