I solved the following problem before I reached the point of posting but I thought it might be worth posting anyway so someone else might solve the problem more quickly than I did. The solution was to use Zadig to change my USBasp driver from libusb-win32 to libusbK. The symptoms of the problem in the first place was:
I'm trying to burn the bootloader to a bare 328P chip and I'm falling at the first hurdle. The current error I am facing is this:
avrdude: Version 7.1-arduino.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is C:\Users\llpr\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.2.2\avrdude.conf
Using Port : usb
Using Programmer : usbasp
avrdude usbOpenDevice() warning: cannot open USB device: Permission denied
avrdude usbasp_open() error: cannot find USB device with vid=0x16c0 pid=0x5dc
avrdude main() error: unable to open programmer usbasp on port usb
avrdude done. Thank you.
Failed chip erase: uploading error: exit status 1
I am using a clone USBasp. The driver libusb-win32 was previously installed using Zadig. Windows version is 10 and Arduino IDE version is 2.0.4. I modified the AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.2.2\avrdude.conf file to comment out lines
#usbvendor = "www.fischl.de";
#usbproduct = "USBasp";
because of an earlier error which mentioned these specific lines which otherwise exclude USBasp clones from working.
USBDeview shows that the USBasp is connected (and Windows Device Manager also reports that it is working properly).