mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-29 12:28:41 +03:00
Merge pull request #1876 from stefanrueger/udev-again
Add more hard-coded usbvid/pid to udev rules
This commit is contained in:
@@ -1577,14 +1577,34 @@ void dev_output_pgm_defs(char *pgmidcp) {
|
||||
}
|
||||
}
|
||||
|
||||
for(LNODEID pidn=lfirst(pgm->usbpid); pidn; pidn=lnext(pidn))
|
||||
udr = add_udev(udr, &ui, usbvid, *(int *) ldata(pidn), ishid, ids);
|
||||
for(LNODEID pidn=lfirst(pgm->usbpid); pidn; pidn=lnext(pidn)) {
|
||||
int pid = *(int *) ldata(pidn);
|
||||
udr = add_udev(udr, &ui, usbvid, pid, ishid, ids);
|
||||
|
||||
// Piggy back PIC Snap devices that can be switched to AVR mode
|
||||
if(usbvid == USB_VENDOR_ATMEL && pid >= 0x217f && pid <= 0x2181) {
|
||||
udr = add_udev(udr, &ui, USB_VENDOR_MICROCHIP, USB_DEVICE_SNAP_PIC_MODE, ishid, ids);
|
||||
udr = add_udev(udr, &ui, USB_VENDOR_MICROCHIP, USB_DEVICE_SNAP_PIC_MODE_BL, ishid, ids);
|
||||
}
|
||||
// Piggy back PIC pickit4 devices that can be switched to AVR ones
|
||||
if(usbvid == USB_VENDOR_ATMEL && pid >= 0x2177 && pid <= 0x2179) {
|
||||
udr = add_udev(udr, &ui, USB_VENDOR_MICROCHIP, USB_DEVICE_PICKIT4_PIC_MODE, ishid, ids);
|
||||
udr = add_udev(udr, &ui, USB_VENDOR_MICROCHIP, USB_DEVICE_PICKIT4_PIC_MODE_BL, ishid, ids);
|
||||
}
|
||||
// Piggy back old usbasp when new one is seen
|
||||
if(usbvid == USBASP_SHARED_VID && pid == USBASP_SHARED_PID)
|
||||
udr = add_udev(udr, &ui, USBASP_OLD_VID, USBASP_OLD_PID, ishid, ids);
|
||||
}
|
||||
}
|
||||
|
||||
if(raw)
|
||||
dev_pgm_raw(pgm);
|
||||
}
|
||||
|
||||
int reboot = 0;
|
||||
for(Dev_udev *u = udr; !reboot && u-udr < ui; u++)
|
||||
reboot |= u->ishid;
|
||||
|
||||
if(udev && ui) {
|
||||
int all = str_eq(pgmidcp, "*");
|
||||
const char *var = all? "": str_asciiname((char *) str_ccprintf("-%s", pgmidcp));
|
||||
@@ -1592,7 +1612,7 @@ void dev_output_pgm_defs(char *pgmidcp) {
|
||||
dev_info("%s -c \"%s/u\" | tail -n +%d | sudo tee /etc/udev/rules.d/55-%s%s.rules\n",
|
||||
progname, pgmidcp, all? 9: 11, progname, var);
|
||||
dev_info("sudo chmod 0644 /etc/udev/rules.d/55-%s%s.rules\n\n", progname, var);
|
||||
dev_info("2. Unplug any AVRDUDE USB programmers and plug them in again\n");
|
||||
dev_info("2. %s\n", reboot? "Reboot your computer": "Unplug any AVRDUDE USB programmers and plug them in again");
|
||||
dev_info("3. Enjoy user access to the USB programmer(s)\n\n");
|
||||
if(!all)
|
||||
dev_info("Note: To install all udev rules known to AVRDUDE follow: %s -c \"*/u\" | more\n\n",
|
||||
|
||||
@@ -1743,6 +1743,7 @@ int jtag3_open_common(PROGRAMMER *pgm, const char *port, int mode_switch) {
|
||||
}
|
||||
if(pic_mode >= 0) {
|
||||
msg_error("\n");
|
||||
cx->usb_access_error = 0;
|
||||
pmsg_error("%s in %s mode detected\n",
|
||||
pgmstr, pinfo.usbinfo.pid == bl_pid? "bootloader": "PIC");
|
||||
if(mode_switch == PK4_SNAP_MODE_AVR) {
|
||||
@@ -1757,7 +1758,7 @@ int jtag3_open_common(PROGRAMMER *pgm, const char *port, int mode_switch) {
|
||||
imsg_error("run %s again to continue the session\n\n", progname);
|
||||
} else {
|
||||
pmsg_error("to switch into AVR mode try\n");
|
||||
imsg_error("$ %s -c%s -p%s -P%s -x mode=avr\n", progname, pgmid, partdesc, port);
|
||||
imsg_error("$ %s -c %s -p %s -P %s -x mode=avr\n", progname, pgmid, partdesc, port);
|
||||
}
|
||||
serial_close(&pgm->fd);
|
||||
return LIBAVRDUDE_EXIT;;
|
||||
|
||||
@@ -614,6 +614,7 @@ static int usbasp_open(PROGRAMMER *pgm, const char *port) {
|
||||
/* check if device with old VID/PID is available */
|
||||
if(usbOpenDevice(pgm, &PDATA(pgm)->usbhandle, USBASP_OLD_VID, "www.fischl.de",
|
||||
USBASP_OLD_PID, "USBasp", port) == 0) {
|
||||
cx->usb_access_error = 0;
|
||||
/* found USBasp with old IDs */
|
||||
pmsg_error("found USB device USBasp with old VID/PID; please update firmware of USBasp\n");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user