nusb/lib: fix wrong endpoint id when openep() finds already existing endpoint file

This commit is contained in:
cinap_lenrek 2016-09-28 19:15:10 +02:00
parent ab3492f05e
commit 9cb3e5900e

View file

@ -54,8 +54,10 @@ openep(Dev *d, int id)
if(access(name, AEXIST) == 0){ if(access(name, AEXIST) == 0){
dprint(2, "%s: %s already exists; trying to open\n", argv0, name); dprint(2, "%s: %s already exists; trying to open\n", argv0, name);
epd = opendev(name); epd = opendev(name);
if(epd != nil) if(epd != nil){
epd->id = id;
epd->maxpkt = ep->maxpkt; /* guess */ epd->maxpkt = ep->maxpkt; /* guess */
}
return epd; return epd;
} }
if(devctl(d, "new %d %d %s", id, ep->type, mode) < 0){ if(devctl(d, "new %d %d %s", id, ep->type, mode) < 0){