<div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div>This patch adds a "device" parameter for Dediprog which enables use of multiple dediprogs connected to a single machine. Very handy for test racks.</div>

<div><br></div><div>Example usage:</div><div>flashrom -p dediprog:device=0</div><div>flashrom -p dediprog:device=1<br></div><div>etc...</div><div><br></div><div>The patch was originally written by Nathan Laredo, I'm just forwarding it upstream:</div>

<div>Signed-off-by: Nathan Laredo <<a href="mailto:nil@google.com">nil@google.com</a>><br></div><div>Signed-off-by: David Hendricks <<a href="mailto:dhendrix@google.com">dhendrix@google.com</a>><br></div><div>

<br></div><div>Index: dediprog.c</div><div>===================================================================</div><div>--- dediprog.c  (revision 1620)</div><div>+++ dediprog.c  (working copy)</div><div>@@ -46,7 +46,9 @@</div>

<div> #endif</div><div><br></div><div> /* Might be useful for other USB devices as well. static for now. */</div><div>-static struct usb_device *get_device_by_vid_pid(uint16_t vid, uint16_t pid)</div><div>+/* device parameter allows user to specify one device of multiple installed */</div>

<div>+static struct usb_device *get_device_by_vid_pid(uint16_t vid, uint16_t pid,</div><div>+                                                int device)</div><div> {</div><div>        struct usb_bus *bus;</div><div>        struct usb_device *dev;</div>

<div>@@ -54,8 +56,11 @@</div><div>        for (bus = usb_get_busses(); bus; bus = bus->next)</div><div>                for (dev = bus->devices; dev; dev = dev->next)</div><div>                        if ((dev->descriptor.idVendor == vid) &&</div>

<div>-                           (dev->descriptor.idProduct == pid))</div><div>-                               return dev;</div><div>+                           (dev->descriptor.idProduct == pid)) {</div><div>+                               if (device == 0)</div>

<div>+                                       return dev;</div><div>+                               device--;</div><div>+                        }</div><div><br></div><div>        return NULL;</div><div> }</div><div>@@ -777,8 +782,9 @@</div>

<div> int dediprog_init(void)</div><div> {</div><div>        struct usb_device *dev;</div><div>-       char *voltage;</div><div>+       char *voltage, *device;</div><div>        int millivolt = 3500;</div><div>+       int usedevice = 0;</div>

<div>        int ret;</div><div><br></div><div>        msg_pspew("%s\n", __func__);</div><div>@@ -792,11 +798,21 @@</div><div>                msg_pinfo("Setting voltage to %i mV\n", millivolt);</div><div>

        }</div><div><br></div><div>+       device = extract_programmer_param("device");</div><div>+       if (device) {</div><div>+               usedevice = strtol(device, NULL, 0);</div><div>+               free(device);</div>

<div>+               if (usedevice < 0)</div><div>+                       return 1;</div><div>+               msg_pinfo("Using device %i\n", usedevice);</div><div>+       }</div><div>+</div><div>+</div><div>
        /* Here comes the USB stuff. */</div>
<div>        usb_init();</div><div>        usb_find_busses();</div><div>        usb_find_devices();</div><div>-       dev = get_device_by_vid_pid(0x0483, 0xdada);</div><div>+       dev = get_device_by_vid_pid(0x0483, 0xdada, usedevice);</div>

<div>        if (!dev) {</div><div>                msg_perr("Could not find a Dediprog SF100 on USB!\n");</div><div>                return 1;</div><div><br></div>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.<br>


</div>