A script presented in the documentation fails in some circumstances

Hi, in this page

at the point 4) a script has been suggested

lspci -nn | grep USB | cut -d '[' -f3 | cut -d ']' -f1 | xargs -I@ sudo setpci -H1 -d @ d0.l=0

but it fails in some particular cases in which description contains a open quare bracket ‘[’ like in my case. This script will works in every not-ill case:

lspci -nn | sed -ne "s,.* USB.* \[\(....:....\)\] .*,\\1,p" | xargs -I@ setpci -H1 -d @ d0.l=0

I hope this helps, R-

2 Likes

Good catch!

The documentation is up on github, and Jolla usually welcomes pull requests with fixes such as this.

Care to submit one?

1 Like

This enhancement mostly misses the point, see last bullet point of the paragraph “Note that:” in section 2 of “Guide: Installing SailfishX on Xperias” for a simpler enhancement, which additionally addresses a different issue.

with a reference to this

sed -ne "s,.* USB.* \[\(....:....\)\] .*,\\1,p"

that section changed in this way

fgrep USB | grep -o '[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:[0-9a-f][0-9a-f][0-9a-f][0-9a-f]'

Unless a real-worl case show up for which my suggestion fails, it should be considered a shorter and simpler solution. If the real-world case shows up, we learn something new, at least me. However, after the suggestion and the guide change, this script has been published:

And in that script even a more sophisticated but shorter way of extracting the value has been implemented:

for i in $(lspci -nn |\
	sed -ne "s,.* USB .* \[\([0-9a-f]\{4\}:[0-9a-f]\{4\}\)\] .*,\\1,p")
		do setpci -H 1 -d $i $pciusb
done

The benefit of this implementation is that many operations can be executed with the value extracted. Just in case the need arises.


Rationale

Finally, this is a case in which - collaboration or a fair¹ competition - improves both sides outcomes and offers an opportunity for all to learn something new or a little more about a topic.

Therefore, it does not matter who is a step ahead because that condition is subject to change in the future. It matters that, step-by-step, we can walk more ahead with a fair competition / collaboration (in the manuals, it is named “co-competition”) rather than a friendly, silent agreement to not walk in others paths.

Hence, it is not about meritocracy but about methodology, because meritocracy is about individuals, while a method is about the process, and the output of the process is the product. Meritocracy is about egos, while a method is about knowing how to do things that we are supposed to not be able to or know how to do. It is about progression, learning by doing.

Finally, if the product is a shit - this is not a fault of the people but a lack of a method.

Notes

¹ fair is a keyword in this context otherwise - soon or later - someone arrives and shows that also cheating is not one of your strongest skill.