Zadig allows you to mix and match your hardware with a particullar driver: WinUSB, libusb, libusb-win32 or libusbK. If you used RTL SDR or any other open sourced project involving USB driver which need a special driver that has API supported by your USB hardware, you might already have this utility on your PC or Laptop. Under Linux I'm using libusb/usbfs to access the real usb device on the client machine (currently using kernel 2.6.35.6). When ever the guest os does a usb reset, and I forward this to the real device, the usbfs driver gets detached from all the interfaces, and after the reset the normal linux drivers attach to the device again.
- Drivers Libusb.org Others Help
- Drivers Libusb.org Others Wanted
- Drivers Libusb.org Others Support
- Drivers Libusb.org Others Help
intlibusb_init(libusb_context **ctx)This function initialises libusb.It must be called at the beginningof the program, before other libusb routines are used.This function returns 0 on success or LIBUSB_ERROR onfailure.
voidlibusb_exit(libusb_context *ctx)Deinitialise libusb.Must be called at the end of the application.Other libusb routines may not be called after this function.
intlibusb_has_capability(uint32_t capability)This function checks the runtime capabilities oflibusb.This function will return non-zero if the givencapabilityis supported, 0 if it is not supported.The valid values forcapabilityare:LIBUSB_CAP_HAS_CAPABILITY | |
libusbsupportslibusb_has_capability(). | |
LIBUSB_CAP_HAS_HOTPLUG | |
libusbsupports hotplug notifications. | |
LIBUSB_CAP_HAS_HID_ACCESS | |
libusbcan access HID devices without requiring user intervention. | |
LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER | |
libusbsupports detaching of the default USB driver withlibusb_detach_kernel_driver(). |
const char *libusb_strerror(int code)Get the ASCII representation of the error given by thecodeargument.This function does not return NULL.
const char *libusb_error_name(int code)Get the ASCII representation of the error enum given by thecodeargument.This function does not return NULL.
voidlibusb_set_debug(libusb_context *ctx, int level)Set the debug level tolevel.
ssize_tlibusb_get_device_list(libusb_context *ctx, libusb_device ***list)Populatelistwith the list of usb devices available, adding a reference to eachdevice in the list.All the list entries created by thisfunction must have their reference counterdecremented when you are done with them,and the list itself must be freed.Thisfunction returns the number of devices in the list or a LIBUSB_ERROR code.
voidlibusb_free_device_list(libusb_device **list, int unref_devices)Free the list of devices discovered by libusb_get_device_list.Ifunref_deviceis set to 1 all devices in the list have their referencecounter decremented once.
uint8_tlibusb_get_bus_number(libusb_device *dev)Returns the number of the bus contained by the devicedev.
uint8_tlibusb_get_port_number(libusb_device *dev)Returns the port number which the device given bydevis attached to.
intlibusb_get_port_numbers(libusb_device *dev, uint8_t *buf, uint8_t bufsize)Stores, in the bufferbufof sizebufsize,the list of all port numbers from root for the devicedev.
intlibusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *buf, uint8_t bufsize)Deprecated function equivalent to libusb_get_port_numbers.
uint8_tlibusb_get_device_address(libusb_device *dev)Returns the device_address contained by the devicedev.
enum libusb_speedlibusb_get_device_speed(libusb_device *dev)Returns the wire speed at which the device is connected.See the LIBUSB_SPEED_XXX enums for more information.LIBUSB_SPEED_UNKNOWN is returned in case of unknown wire speed.
intlibusb_get_max_packet_size(libusb_device *dev, unsigned char endpoint)Returns the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if theendpoint does not exist and LIBUSB_ERROR_OTHERS on other failure.
intlibusb_get_max_iso_packet_size(libusb_device *dev, unsigned char endpoint)Returns the packet size multiplied by the packet multiplier on success,LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist andLIBUSB_ERROR_OTHERS on other failure.
libusb_device *libusb_ref_device(libusb_device *dev)Increment the reference counter of the devicedev.
Drivers Libusb.org Others Help
voidlibusb_unref_device(libusb_device *dev)Decrement the reference counter of the devicedev.
intlibusb_open(libusb_device *dev, libusb_device_handle **devh)Open a device and obtain a device_handle.Returns 0 on success,LIBUSB_ERROR_NO_MEM on memory allocation problems, LIBUSB_ERROR_ACCESSon permissions problems, LIBUSB_ERROR_NO_DEVICE if the device has beendisconnected and a LIBUSB_ERROR code on other errors.
libusb_device_handle *libusb_open_device_with_vid_pid(libusb_context *ctx, uint16_t vid, uint16_t pid)A convenience function to open a device by vendor and product IDsvidandpid.Returns NULL on error.
voidlibusb_close(libusb_device_handle *devh)Close a device handle.
libusb_device *libusb_get_device(libusb_device_handle *devh)Get the device contained by devh.Returns NULL on error.
intlibusb_get_configuration(libusb_device_handle *devh, int *config)Returns the value of the current configuration.Returns 0on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnectedand a LIBUSB_ERROR code on error.
intlibusb_set_configuration(libusb_device_handle *devh, int config)Set the active configuration toconfigfor the device contained bydevh.This function returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the requestedconfiguration does not exist, LIBUSB_ERROR_BUSY if the interfaces are currentlyclaimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and aLIBUSB_ERROR code on failure.
intlibusb_claim_interface(libusb_device_handle *devh, int interface_number)Claim an interface in a given libusb_handledevh.This is a non-blocking function.It returns 0 on success, LIBUSB_ERROR_NOT_FOUNDif the requested interface does not exist, LIBUSB_ERROR_BUSY if a program ordriver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device hasbeen disconnected and a LIBUSB_ERROR code on failure.
intlibusb_release_interface(libusb_device_handle *devh, int interface_number)This function releases an interface.All the claimed interfaces on a device must be releasedbefore closing the device.Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if theinterface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has beendisconnected and LIBUSB_ERROR on failure.
intlibusb_set_interface_alt_setting(libusb_device_handle *dev, int interface_number, int alternate_setting)Activate an alternate setting for an interface.Returns 0 on success,LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requestedsetting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has beendisconnected and a LIBUSB_ERROR code on failure.
intlibusb_clear_halt(libusb_device_handle *devh, unsigned char endpoint)Clear an halt/stall for a endpoint.Returns 0 on success, LIBUSB_ERROR_NOT_FOUNDif the endpoint does not exist, LIBUSB_ERROR_NO_DEVICE if the device has beendisconnected and a LIBUSB_ERROR code on failure.
Drivers Libusb.org Others Wanted
intlibusb_reset_device(libusb_device_handle *devh)Perform an USB port reset for an usb device.Returns 0 on success,LIBUSB_ERROR_NOT_FOUND if re-enumeration is required or if the device hasbeen disconnected and a LIBUSB_ERROR code on failure.
intlibusb_check_connected(libusb_device_handle *devh)Test if the USB device is still connected.Returns 0 on success,LIBUSB_ERROR_NO_DEVICE if it has been disconnected and a LIBUSB_ERRORcode on failure.
intlibusb_kernel_driver_active(libusb_device_handle *devh, int interface)Determine if a driver is active on a interface.Returns 0 if no kernel driver is activeand 1 if a kernel driver is active, LIBUSB_ERROR_NO_DEVICEif the device has been disconnected and a LIBUSB_ERROR code on failure.
intlibusb_get_driver(libusb_device_handle *devh, int interface, char *name, int namelen)or intlibusb_get_driver_np(libusb_device_handle *devh, int interface, char *name, int namelen)Copy the name of the driver attached to the givendeviceandinterfaceinto the buffernameof lengthnamelen.Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attachedto the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface doesnot exist.This function is non-portable.The buffer pointed to bynameis only zero terminated on success.
intlibusb_detach_kernel_driver(libusb_device_handle *devh, int interface)or intlibusb_detach_kernel_driver_np(libusb_device_handle *devh, int interface)Detach a kernel driver from an interface.This is needed to claim an interface already claimed by a kernel driver.Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active,LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,LIBUSB_ERROR_NO_DEVICE if the device has been disconnectedand a LIBUSB_ERROR code on failure.This function is non-portable.
intlibusb_attach_kernel_driver(libusb_device_handle *devh, int interface)Re-attach an interface kernel driver that was previously detached.Returns 0 on success,LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,LIBUSB_ERROR_NO_DEVICEif the device has been disconnected, LIBUSB_ERROR_BUSY if the driver cannot beattached because the interface is claimed by a program or driver and aLIBUSB_ERROR code on failure.
intlibusb_set_auto_detach_kernel_driver(libusb_device_handle *devh, int enable)This function enables automatic kernel interface driver detach when aninterface is claimed.When the interface is restored the kernel driver is allowed to be re-attached.If theenableargument is non-zero the feature is enabled.Else disabled.Returns 0 on success and a LIBUSB_ERROR code onfailure.
To support the 64-bit version of Windows it has been necessary to update to using libusb1.0 drivers. For consistency this is also done on Linux and the other windows platforms. As part of this process the Vendor-ID/Product-ID (VID/PID) for the hardware (BDM) has been changed. This will allow the co-existence of Freescale's OSBDM-JM60 hardware while using a new driver for USBDM. Formerly both these BDMs used the same VID/PID and changes to the driver would not be possible without rendering the OSBDM-JM60 inoperable.
Note: On Windows, libusb1.0 is a thin wrapper around the Microsoft winUSB low-level USB drivers. Because of this you may see references to winusb in the following.
Note for upgrading from version 3.x to 4.x USBDM firmware
This change is complicated by the existence of a Bootloader in the BDM firmware. If not replaced this loader will continue to use the original VID/PID. Because of this, it is desirable to completely replace the BDM firmware.
For JS16 based BDMs this is a simple process since the Freescale JS12 Bootloader software may be used to replace all the firmware. See Construction and Installation.
For JMxx based BDMs it is necessary to use a HCS08 programmer to re-program the entire device so that the Bootloader is updated when the rest of firmware is changed. If a programmer is not available then it is still possible to update the BDM firmware using the Bootloader but the Bootloader will remain unchanged. To do this it will be necessary to install the drivers twice - once for the old VID/PID used by the Bootloader and again for the new VID/PID used by the main firmware. Doing so will render any OSBDM drivers inoperable on that USB port.
Installation of USBDM USB drivers for Linux
There isn't any. The installation script provided will modify the /etc/udev/rules.d file to allow access to the USBDM device. The required driver for USBDM BDM interface (LibusbV1) is included in the standard Linux (at least Ubuntu current version). The CDC (serial port) is a standard device and should also be installed without any extra steps.
If more installation is required on your version you will have to investigate this yourself. I'm not a Linux expert and I don't have access to other versions for testing. If you find other steps are necessary then please advise and I will try to update the installation accordingly.
Installation of USBDM USB drivers for Windows
This driver allows the USBDM software to communicate with the USBDM cable. You would usually only need to install these driver files once. If you subsequently plug the USBDM cable into another USB port of the same computer the driver will be installed for that port automatically.
The required drivers are copied to the installation location as part of the installation process. The driver folder may be opened from the window's Start Menu.
Setting up the drivers differs somewhat between the different versions of windows. In versions before Windows 7 you will be automatically prompted to install the drivers using a Found New Hardware Wizard when you first plug in the USBDM. For Windows 7 the installation will quietly fail and it is necessary to manually trigger the wizard.
Prior to Windows 7 the following sequence should occur:
- 1. Plug in the USBDM.
- 2. The Found New Hardware Wizard should appear. Select the Install from a list or a specific location option.
Select Next to continue. - 3. Select the options as shown and navigate to the driver directory. 'C:Program FilespgoUSBDM 4.7.0USBDM_Drivers'.
Select Next to continue. - 4. The next step may take a while but you should eventually be presented with last dialogue shown.
Select Finish to close the dialogue.
The above sequence may be necessary a second time if you are installing a USBDM supporting a serial port connection. The serial port appears as a second device.
With Windows 7 the following sequence should occur:
- 1. Plug in the USBDM.
- 2. A small pop-up alert indicates windows is searching for the drivers.
- 3. Eventually this will be unsuccessful
- 4. You can click on the pop-up to view the result. The CDC Interface is not present on all USBDMs.
- 5. To properly install the drivers it is necessary to open the Computer Properties ...
- 6. ...and then the Device manager.
- 7. Locate the USBDM device(s), right-click and select Update Driver Software... from the menu.
- 8. Select the second option as we need to specify where to find the drivers.
- 9. Browse to the driver directory 'C:Program FilespgoUSBDM 4.7.0USBDM_Drivers'. Make sure Include subfolders is selected.
- 10. The driver is signed but the driver inf files aren't. This results in a Windows Security dialogue. It is necessary to confirm the installation.
- 11. Eventually the installation should complete successfully.
- 12. You can confirm the USBDM device in the device manager.
- 13. Repeat this process with the USBDM CDC Device (Serial port) if present.
- 14. You can confirm the USBDM serial port in the device manager. The serial port number assigned is unique to the BDM providing it has a unique serial number. This allows multiple USBDMs to be present at the one time.
After installation of the serial port you may examine or change the communication properties. Right-click on the USBDM Serial Port and select Properties. - 15. The usual communication properties appear. The USBDM serial port is limited in what baud rate and options are supported. (I will eventually tell you what ones here when I get a chance to check :) Advanced options are available. Click on Advanced...
- 16. One option worth noting is that you may also re-assign the COM port number used.
Alternative Driver Installation Method for Windows
Alternatively, zadig may be used to install the libusbV1 drivers for the BDM interface (not the Serial port). http://www.libusb.org/wiki/libwdi/zadig
Preliminary
- Download the current version of the required driver installation program from Windows Backend - libusb or using the direct link (at this time) zadig.exe.
- Plug in the programmed BDM.
- Cancel any dialogues prompting to install the device drivers.
- Under Windows 7 the automatic driver installation will proceed and fail.
This following process will install the correct libusb 1.0 driver.
- 1. Run the zadig_XXX.exe program.
- 2. Select the BDM from the list of devices. Under Windows Vista and Windows 7 the device description will be USBDM BDM Interface. Under Windows XP it may simply appear as USB Device.
- Check carefully that the Vendor ID and Product ID are 16D0 and 0567 respectively. There may also be a third number if the USBDM has a serial interface. This should be zero(0) if present.
- If the description is anonymous click on the Edit Desc. checkbox and change it to something more meaningful.
- Check that the WinUSB driver is the Target.
- 3. Click the Install Driver button. This will install the driver files. You may see a number of dialogues.
This may take a while!
Select Yes to refresh the list of devices.
Drivers Libusb.org Others Support
- 4. If you now plug in an updated BDM to another USB port the Found New Hardware wizard should automatically appear. If prompted accept the recommended options to install the driver. Under Windows-7 there may be a prompt to accept an unsigned driver.
- 5. The Found New Hardware wizard should now complete. Just click Finish to close the dialogue.
Installation of USBDM USB drivers for old VID/PID
This process should only be done if you need to use the USBDM Bootloader to update an old JMxx based BDM when you do not have access to a HCS08 programmer.
Preliminary
Drivers Libusb.org Others Help
- Plug in the old BDM before proceeding.
- Do not move the BDM to another port before updating the firmware as the driver installation will apply only to that port.
- If the BDM has already been updated once, then it may be necessary to use the setboot.exe utility to place the BDM in ICP mode before installing the driver.
Procedure:
- 1. Run the zadig_XXX.exe program.
- 2. Choose Options->List All Devices from the menu so that all devices are available for installation.
- 3. Select the BDM from the list of devices. The description of the device will depend upon which device driver has been previously used. In either case check carefully that the Vendor ID and Product ID are 15A2 and 0021 respectively. Click on the Edit Desc. checkbox and change the description to something more meaningful. This will make the device easier to identify in the future.
- 4. Make sure that WinUSB is selected as the Target Driver
Click the Install Driver button. This will install the driver for the selected device. You may see a number of dialogues as shown above.
- The device should now be using the new driver and the USBDM Bootloader program may be used to update the firmware.
- If desired, a similar process may be used to restore the original libusb driver if it is needed for other devices. Just select the correct Target Driver.
Linux Drivers
The shell scripts supplied with the linux version should install the required information for the libusb drivers to work on a linux machine.
You will also need to make sure you have installed some libraries: (Some information posted by joncas on Freescale Forums - thanks)