Report dfu boot problem to LPC Link2 with lpscrypt under Linux

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Report dfu boot problem to LPC Link2 with lpscrypt under Linux

跳至解决方案
1,059 次查看
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 项奖励
回复
1 解答
1,001 次查看
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 项奖励
回复
2 回复数
1,002 次查看
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 项奖励
回复
993 次查看
sprhawk
Contributor II
Thanks. I have made my own fixes.
Just hope next release will have a more general fixes for it.
0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-1924098%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9C%A8%20Linux%20%E4%B8%8B%E4%BD%BF%E7%94%A8%20lpscrypt%20%E5%90%91%20LPC%20Link2%20%E6%8A%A5%E5%91%8A%20dfu%20%E5%90%AF%E5%8A%A8%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1924098%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ELinux%E4%B8%8Blpcscrypt%E4%B8%AD%E7%9A%84dfu_boot%E8%84%9A%E6%9C%AC%E5%AD%98%E5%9C%A8%E9%97%AE%E9%A2%98%E3%80%82%E8%AF%A5%E7%89%88%E6%9C%AC%E9%80%9A%E8%BF%87%20LinkServer_1.6.133.x86_64.deb.bin%20%E5%AE%89%E8%A3%85%3C%2FP%3E%3CP%3E%E6%88%91%E5%AE%89%E8%A3%85%E7%9A%84%20dfu-util%20%E6%98%AF%200.11%3C%2FP%3E%3CP%3E%E5%85%B6%E8%BE%93%E5%87%BA%E5%A6%82%E4%B8%8B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%20translate%3D%22no%22%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%3E%E4%BD%86%E7%94%9F%E6%88%90%E7%9A%84%20vp_hex%20%E5%B9%B6%E6%9C%AA%E5%BE%97%E5%88%B0%E7%BA%A0%E6%AD%A3%EF%BC%9A%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%3E%E5%9B%A0%E4%B8%BA%E8%BF%99%E9%87%8C%E7%9A%84%20DEVICE_VID_PID%20%E6%98%AF%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%3E%E8%BF%99%E9%98%BB%E6%AD%A2%E6%A3%80%E6%B5%8B%20dfu%20%E6%A8%A1%E5%BC%8F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1926808%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%9C%A8%20Linux%20%E4%B8%8B%E4%BD%BF%E7%94%A8%20lpscrypt%20%E5%90%91%20LPC%20Link2%20%E6%8A%A5%E5%91%8A%20dfu%20%E5%90%AF%E5%8A%A8%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1926808%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E8%B0%A2%E8%B0%A2%E3%80%82%E6%88%91%E5%B7%B2%E7%BB%8F%E5%81%9A%E5%87%BA%E4%BA%86%E8%87%AA%E5%B7%B1%E7%9A%84%E4%BF%AE%E5%A4%8D%E3%80%82%3CBR%20%2F%3E%E5%8F%AA%E6%98%AF%E5%B8%8C%E6%9C%9B%E4%B8%8B%E4%B8%80%E4%B8%AA%E7%89%88%E6%9C%AC%E8%83%BD%E5%A4%9F%E5%AF%B9%E6%AD%A4%E8%BF%9B%E8%A1%8C%E6%9B%B4%E5%85%A8%E9%9D%A2%E7%9A%84%E4%BF%AE%E5%A4%8D%E3%80%82%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1926284%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%9C%A8%20Linux%20%E4%B8%8B%E4%BD%BF%E7%94%A8%20lpscrypt%20%E5%90%91%20LPC%20Link2%20%E6%8A%A5%E5%91%8A%20dfu%20%E5%90%AF%E5%8A%A8%E9%97%AE%E9%A2%98%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%3E%E7%9C%8B%E8%B5%B7%E6%9D%A5%E8%84%9A%E6%9C%AC%E6%B2%A1%E6%9C%89%E6%AD%A3%E7%A1%AE%E8%A7%A3%E6%9E%90%20dfu-util%20%E7%89%88%E6%9C%AC%EF%BC%8C%E5%9B%A0%E6%AD%A4%20vp_hex%20%E5%8F%98%E9%87%8F%E6%B2%A1%E6%9C%89%E8%A2%AB%E6%AD%A3%E7%A1%AE%E8%AE%BE%E7%BD%AE%E3%80%82%E6%82%A8%E7%9A%84%E8%BE%93%E5%87%BA%E6%98%BE%E7%A4%BA%20dfu-util%20%E7%89%88%E6%9C%AC%200.11%EF%BC%8C%E4%BD%86%E8%84%9A%E6%9C%AC%E6%97%A0%E6%B3%95%E6%AD%A3%E7%A1%AE%E5%A4%84%E7%90%86%E5%AE%83%E3%80%82%3CBR%20%2F%3E%E4%BB%A5%E4%B8%8B%E6%98%AF%E6%AD%A3%E7%A1%AE%E5%A4%84%E7%90%86%20dfu-util%20%E7%89%88%E6%9C%AC%200.11%20%E7%9A%84%E8%84%9A%E6%9C%AC%E4%BF%AE%E5%A4%8D%E7%A8%8B%E5%BA%8F%EF%BC%9A%3CBR%20%2F%3E%201.%E8%B0%83%E6%95%B4%E8%84%9A%E6%9C%AC%E4%BB%A5%E6%AD%A3%E7%A1%AE%E8%A7%A3%E6%9E%90dfu-util%E7%89%88%E6%9C%AC%E3%80%82%3CBR%20%2F%3E%202.%20%E6%A0%B9%E6%8D%AE%E6%A3%80%E6%B5%8B%E5%88%B0%E7%9A%84%E7%89%88%E6%9C%AC%E8%AE%BE%E7%BD%AE%20vp_hex%20%E5%8F%98%E9%87%8F%E3%80%82%3CBR%20%2F%3E%23%20%E7%A1%AE%E5%AE%9A%E5%9C%A8%20-l%20%E4%B8%AD%E5%88%97%E5%87%BA%E6%97%B6%20VID%3APID%20%E5%85%B7%E6%9C%89%E4%BB%80%E4%B9%88%E6%A0%B7%E7%9A%84%E5%89%8D%E7%BC%80%3CBR%20%2F%3Evp_hex%3D%22%22%3CBR%20%2F%3E%20%23%20%E6%8F%90%E5%8F%96%E4%B8%BB%E8%A6%81%E7%89%88%E6%9C%AC%E5%92%8C%E6%AC%A1%E8%A6%81%E7%89%88%E6%9C%AC%3CBR%20%2F%3Edfu_major_ver%3D%24%EF%BC%88echo%E2%80%9C%24dfu_ver%E2%80%9D%7Ccut-d'%E3%80%82'-f%201%EF%BC%89%3CBR%20%2F%3E%20dfu_minor_ver%3D%24%EF%BC%88echo%E2%80%9C%24dfu_ver%E2%80%9D%7Ccut-d'%E3%80%82'-f%202%EF%BC%89%3CBR%20%2F%3E%20%23%20%E6%A3%80%E6%9F%A5%20dfu_major_ver%20%E6%98%AF%E5%90%A6%E4%B8%BA%200%20%E4%B8%94%20dfu_minor_ver%20%E6%98%AF%E5%90%A6%E4%B8%BA%2011%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%20%5B%20%E2%80%9C%24dfu_major_ver%E2%80%9D%20-eq%200%20%5D%20%26amp%3B%26amp%3B%20%5B%20%E2%80%9C%24dfu_minor_ver%E2%80%9D%20-eq%2011%20%5D%3B%20%E7%84%B6%E5%90%8E%3CBR%20%2F%3Evp_hex%3D%220x%22%3CBR%20%2F%3E%E8%8F%B2%3CBR%20%2F%3E%23%20echo%20%22DFU%20%E7%89%88%E6%9C%AC%20%24dfu_ver%20%E6%84%8F%E5%91%B3%E7%9D%80%E6%88%91%E4%BB%AC%E5%BA%94%E8%AF%A5%E4%BD%BF%E7%94%A8%E5%8D%81%E5%85%AD%E8%BF%9B%E5%88%B6%E5%89%8D%E7%BC%80%20'%24vp_hex'%22%3CBR%20%2F%3E%20DEVICE_VID_PID%3D%22%20%24%7Bvp_hex%7D%20%24%7BDEVICE_VID%7D%20%3A%20%24%7Bvp_hex%7D%20%24%7BDEVICE_PID%7D%20%22%3CBR%20%2F%3E%20%23DEVICE_VID_PID%3D%22%5C(0x%5C%7C%5C)%24DEVICE_VID%3A%5C(0x%5C%7C%5C)%24DEVICE_PID%22%3CBR%20%2F%3E%E8%AF%A5%E8%84%9A%E6%9C%AC%E6%AD%A3%E7%A1%AE%E6%A3%80%E6%9F%A5%20dfu-util%20%E7%9A%84%E4%B8%BB%E7%89%88%E6%9C%AC%E5%92%8C%E6%AC%A1%E7%89%88%E6%9C%AC%EF%BC%8C%E5%B9%B6%E7%9B%B8%E5%BA%94%E5%9C%B0%E8%AE%BE%E7%BD%AE%20vp_hex%20%E5%8F%98%E9%87%8F%E3%80%82%E5%AE%83%E5%BA%94%E8%AF%A5%E5%8F%AF%E4%BB%A5%E8%A7%A3%E5%86%B3%E9%94%99%E8%AF%AF%E8%AE%BE%E7%BD%AE%20DEVICE_VID_PID%20%E5%8F%98%E9%87%8F%E7%9A%84%E9%97%AE%E9%A2%98%E3%80%82%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3E%E6%82%AC%E6%8C%82%3C%2FP%3E%3C%2FLINGO-BODY%3E