boundarydevices / imx_usb_loader

USB & UART loader for i.MX5/6/7/8 series
GNU Lesser General Public License v2.1
260 stars 158 forks source link

Regression in 29fa8ab #108

Open svenschwermer opened 4 years ago

svenschwermer commented 4 years ago

Commit 29fa8ab seems to have introduced a regression, I'm getting the following error after the commit:

config file </home/sven/mys-dac/usb-loader-config/imx_usb.conf>
vid=0x15a2 pid=0x0080 file_name=mx6ull_usb_rom.conf
-> vid=0x0525 pid=0xb4a4 file_name=mx6ull_usb_spl.conf
config file </home/sven/mys-dac/usb-loader-config/mx6ull_usb_rom.conf>
parse /home/sven/mys-dac/usb-loader-config/mx6ull_usb_rom.conf
Trying to open device vid=0x15a2 pid=0x0080
Interface 0 claimed
HAB security state: development mode (0x56787856)
== work item
filename /home/sven/mys-dac/u-boot/SPL
load_size 0 bytes
load_addr 0x00000000
dcd 0
clear_dcd 0
plug 0
jump_mode 3
jump_addr 0x00000000
== end work item

loading binary file(/home/sven/mys-dac/u-boot/SPL) to 00907400, skip=0, fsize=ac00 type=aa

<<<44032, 44032 bytes>>>
succeeded (security 0x56787856, status 0x88888888)
jumping to 0x00907400
config file </home/sven/mys-dac/usb-loader-config/mx6ull_usb_spl.conf>
parse /home/sven/mys-dac/usb-loader-config/mx6ull_usb_spl.conf
Trying to open device vid=0x0525 pid=0xb4a4
Interface 0 claimed
do_command err=-1, last_trans=0
do_command err=-1, last_trans=0
do_command err=-1, last_trans=0
do_command err=-1, last_trans=0
do_command err=-1, last_trans=0
status failed

On the previous commit (abe7f5d), the output looks like this:

config file </home/sven/mys-dac/usb-loader-config/imx_usb.conf>
vid=0x15a2 pid=0x0080 file_name=mx6ull_usb_rom.conf
-> vid=0x0525 pid=0xb4a4 file_name=mx6ull_usb_spl.conf
config file </home/sven/mys-dac/usb-loader-config/mx6ull_usb_rom.conf>
parse /home/sven/mys-dac/usb-loader-config/mx6ull_usb_rom.conf
Trying to open device vid=0x15a2 pid=0x0080
Interface 0 claimed
HAB security state: development mode (0x56787856)
== work item
filename /home/sven/mys-dac/u-boot/SPL
load_size 0 bytes
load_addr 0x00000000
dcd 0
clear_dcd 0
plug 0
jump_mode 3
jump_addr 0x00000000
== end work item

loading binary file(/home/sven/mys-dac/u-boot/SPL) to 00907400, skip=0, fsize=ac00 type=aa

<<<44032, 44032 bytes>>>
succeeded (security 0x56787856, status 0x88888888)
jumping to 0x00907400
config file </home/sven/mys-dac/usb-loader-config/mx6ull_usb_spl.conf>
parse /home/sven/mys-dac/usb-loader-config/mx6ull_usb_spl.conf
Trying to open device vid=0x0525 pid=0xb4a4
Interface 0 claimed
HAB security state: development mode (0x56787856)
== work item
filename /home/sven/mys-dac/u-boot/u-boot-dtb.img
load_size 0 bytes
load_addr 0x00000000
dcd 0
clear_dcd 0
plug 0
jump_mode 3
jump_addr 0x00000000
== end work item

loading binary file(/home/sven/mys-dac/u-boot/u-boot-dtb.img) to 877fffc0, skip=0, fsize=77f26 type=aa

<<<491302, 491302 bytes>>>
succeeded (security 0x56787856, status 0x88888888)
jumping to 0x877fffc0

These are my config files:

#vid:pid, config_file
0x15a2:0x0080, mx6ull_usb_rom.conf, 0x0525:0xb4a4, mx6ull_usb_spl.conf
mx6ull_usb_rom
#hid/bulk,[old_header,]max packet size, dcd_addr, {ram start, ram size}(repeat valid ram areas)
hid,1024,0x00900000,128k
/home/sven/mys-dac/u-boot/SPL:jump header
mx6ull_usb_spl
hid,uboot_header,1024,0x80000000,256M
/home/sven/mys-dac/u-boot/u-boot-dtb.img:jump header
svenschwermer commented 3 years ago

Commit 29fa8ab doesn't make any sense to me. If you have multiple VIDs/PIDs in the chain (e.g. ROM/SPL), we cannot just reuse the initial USB device. Since the secondary device only shows up after the first device has been talked to, another device listing/scan is required. That's implicitly done by libusb_open_device_with_vid_pid.