Report dfu boot problem to LPC Link2 with lpscrypt under Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Report dfu boot problem to LPC Link2 with lpscrypt under Linux

Jump to solution
988 Views
sprhawk
Contributor II

There is a problem in dfu_boot script in lpcscrypt under linux. the version is installed via LinkServer_1.6.133.x86_64.deb.bin

My installed dfu-util is 0.11

whose output is following

dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [1fc9:000c] ver=0100, devnum=115, cfg=1, intf=0, path="3-1", alt=0, name="DFU", serial="ABCD"

 

but vp_hex generated is not corrected:

sprhawk_1-1722609817329.png

cause here DEVICE_VID_PID is 0x1f9c:0x000c

sprhawk_0-1722609793109.png

Which prevents from detecting dfu mode

0 Kudos
Reply
1 Solution
930 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @sprhawk 

It looks like the script is not correctly parsing the dfu-util version and as a result, the vp_hex variable is not being set properly. Your output indicates dfu-util version 0.11, but the script is not handling this correctly.
Here’s a fix for the script to correctly handle dfu-util version 0.11:
1. Adjust the script to correctly parse the dfu-util version.
2. Set the vp_hex variable based on the version detected.
# Establish what kind of prefix VID:PIDs have when listed in -l
vp_hex=""
# Extract major and minor versions
dfu_major_ver=$(echo "$dfu_ver" | cut -d '.' -f 1)
dfu_minor_ver=$(echo "$dfu_ver" | cut -d '.' -f 2)
# Check if dfu_major_ver is 0 and dfu_minor_ver is 11
if [ "$dfu_major_ver" -eq 0 ] && [ "$dfu_minor_ver" -eq 11 ]; then
vp_hex="0x"
fi
# echo "DFU version $dfu_ver means we should use hex prefix '$vp_hex'"
DEVICE_VID_PID="${vp_hex}${DEVICE_VID}:${vp_hex}${DEVICE_PID}"
# DEVICE_VID_PID="\(0x\|\)$DEVICE_VID:\(0x\|\)$DEVICE_PID"
This script correctly checks for the major and minor version of dfu-util and sets the vp_hex variable accordingly. It should resolve the issue of incorrectly setting the DEVICE_VID_PID variable.

BR

Hang

View solution in original post

0 Kudos
Reply
2 Replies
931 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @sprhawk 

It looks like the script is not correctly parsing the dfu-util version and as a result, the vp_hex variable is not being set properly. Your output indicates dfu-util version 0.11, but the script is not handling this correctly.
Here’s a fix for the script to correctly handle dfu-util version 0.11:
1. Adjust the script to correctly parse the dfu-util version.
2. Set the vp_hex variable based on the version detected.
# Establish what kind of prefix VID:PIDs have when listed in -l
vp_hex=""
# Extract major and minor versions
dfu_major_ver=$(echo "$dfu_ver" | cut -d '.' -f 1)
dfu_minor_ver=$(echo "$dfu_ver" | cut -d '.' -f 2)
# Check if dfu_major_ver is 0 and dfu_minor_ver is 11
if [ "$dfu_major_ver" -eq 0 ] && [ "$dfu_minor_ver" -eq 11 ]; then
vp_hex="0x"
fi
# echo "DFU version $dfu_ver means we should use hex prefix '$vp_hex'"
DEVICE_VID_PID="${vp_hex}${DEVICE_VID}:${vp_hex}${DEVICE_PID}"
# DEVICE_VID_PID="\(0x\|\)$DEVICE_VID:\(0x\|\)$DEVICE_PID"
This script correctly checks for the major and minor version of dfu-util and sets the vp_hex variable accordingly. It should resolve the issue of incorrectly setting the DEVICE_VID_PID variable.

BR

Hang

0 Kudos
Reply
922 Views
sprhawk
Contributor II
Thanks. I have made my own fixes.
Just hope next release will have a more general fixes for it.
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1924098%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EReport%20dfu%20boot%20problem%20to%20LPC%20Link2%20with%20lpscrypt%20under%20Linux%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1924098%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThere%20is%20a%20problem%20in%20dfu_boot%20script%20in%20lpcscrypt%20under%20linux.%20the%20version%20is%20installed%20via%20LinkServer_1.6.133.x86_64.deb.bin%3C%2FP%3E%3CP%3EMy%20installed%20dfu-util%20is%200.11%3C%2FP%3E%3CP%3Ewhose%20output%20is%20following%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Edfu-util%200.11%0A%0ACopyright%202005-2009%20Weston%20Schmidt%2C%20Harald%20Welte%20and%20OpenMoko%20Inc.%0ACopyright%202010-2021%20Tormod%20Volden%20and%20Stefan%20Schmidt%0AThis%20program%20is%20Free%20Software%20and%20has%20ABSOLUTELY%20NO%20WARRANTY%0APlease%20report%20bugs%20to%20http%3A%2F%2Fsourceforge.net%2Fp%2Fdfu-util%2Ftickets%2F%0A%0AFound%20DFU%3A%20%5B1fc9%3A000c%5D%20ver%3D0100%2C%20devnum%3D115%2C%20cfg%3D1%2C%20intf%3D0%2C%20path%3D%223-1%22%2C%20alt%3D0%2C%20name%3D%22DFU%22%2C%20serial%3D%22ABCD%22%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3Ebut%20vp_hex%20generated%20is%20not%20corrected%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22sprhawk_1-1722609817329.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22sprhawk_1-1722609817329.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F291743i73C63A22A2294AB1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22sprhawk_1-1722609817329.png%22%20alt%3D%22sprhawk_1-1722609817329.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Ecause%20here%20DEVICE_VID_PID%20is%200x1f9c%3A0x000c%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22sprhawk_0-1722609793109.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22sprhawk_0-1722609793109.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F291742iC3C0054FFA45D8F4%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22sprhawk_0-1722609793109.png%22%20alt%3D%22sprhawk_0-1722609793109.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EWhich%20prevents%20from%20detecting%20dfu%20mode%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1926808%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Report%20dfu%20boot%20problem%20to%20LPC%20Link2%20with%20lpscrypt%20under%20Linux%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1926808%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThanks.%20I%20have%20made%20my%20own%20fixes.%3CBR%20%2F%3EJust%20hope%20next%20release%20will%20have%20a%20more%20general%20fixes%20for%20it.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1926284%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Report%20dfu%20boot%20problem%20to%20LPC%20Link2%20with%20lpscrypt%20under%20Linux%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1926284%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F233915%22%20target%3D%22_blank%22%3E%40sprhawk%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20looks%20like%20the%20script%20is%20not%20correctly%20parsing%20the%20dfu-util%20version%20and%20as%20a%20result%2C%20the%20vp_hex%20variable%20is%20not%20being%20set%20properly.%20Your%20output%20indicates%20dfu-util%20version%200.11%2C%20but%20the%20script%20is%20not%20handling%20this%20correctly.%3CBR%20%2F%3EHere%E2%80%99s%20a%20fix%20for%20the%20script%20to%20correctly%20handle%20dfu-util%20version%200.11%3A%3CBR%20%2F%3E1.%20Adjust%20the%20script%20to%20correctly%20parse%20the%20dfu-util%20version.%3CBR%20%2F%3E2.%20Set%20the%20vp_hex%20variable%20based%20on%20the%20version%20detected.%3CBR%20%2F%3E%23%20Establish%20what%20kind%20of%20prefix%20VID%3APIDs%20have%20when%20listed%20in%20-l%3CBR%20%2F%3Evp_hex%3D%22%22%3CBR%20%2F%3E%23%20Extract%20major%20and%20minor%20versions%3CBR%20%2F%3Edfu_major_ver%3D%24(echo%20%22%24dfu_ver%22%20%7C%20cut%20-d%20'.'%20-f%201)%3CBR%20%2F%3Edfu_minor_ver%3D%24(echo%20%22%24dfu_ver%22%20%7C%20cut%20-d%20'.'%20-f%202)%3CBR%20%2F%3E%23%20Check%20if%20dfu_major_ver%20is%200%20and%20dfu_minor_ver%20is%2011%3CBR%20%2F%3Eif%20%5B%20%22%24dfu_major_ver%22%20-eq%200%20%5D%20%26amp%3B%26amp%3B%20%5B%20%22%24dfu_minor_ver%22%20-eq%2011%20%5D%3B%20then%3CBR%20%2F%3Evp_hex%3D%220x%22%3CBR%20%2F%3Efi%3CBR%20%2F%3E%23%20echo%20%22DFU%20version%20%24dfu_ver%20means%20we%20should%20use%20hex%20prefix%20'%24vp_hex'%22%3CBR%20%2F%3EDEVICE_VID_PID%3D%22%24%7Bvp_hex%7D%24%7BDEVICE_VID%7D%3A%24%7Bvp_hex%7D%24%7BDEVICE_PID%7D%22%3CBR%20%2F%3E%23%20DEVICE_VID_PID%3D%22%5C(0x%5C%7C%5C)%24DEVICE_VID%3A%5C(0x%5C%7C%5C)%24DEVICE_PID%22%3CBR%20%2F%3EThis%20script%20correctly%20checks%20for%20the%20major%20and%20minor%20version%20of%20dfu-util%20and%20sets%20the%20vp_hex%20variable%20accordingly.%20It%20should%20resolve%20the%20issue%20of%20incorrectly%20setting%20the%20DEVICE_VID_PID%20variable.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHang%3C%2FP%3E%3C%2FLINGO-BODY%3E