Not able to echo to slots in BeagleBone Black - beagleboneblack

I newly started working with BeagleBone Black and Device Tree Overlays.
I wrote a Device Tree Overlay, compiled it and copied to /lib/firmware, but when I am trying to echo it to /sys/devices/platform/bone_capemgr/slots I get this error:
root#arm:~# echo APOLLO-PCB-RevA > /sys/devices/platform/bone_capemgr/slots
bash: echo: write error: Invalid argument
When I cat the slots I find the following:
root#arm:~# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
Can anyone please tell me what is the issue?

Related

syntax error: operand expected (error token is "))")

I am trying to align my samples to a reference genome using bwa mem.
I have over 300 samples which I created an index from a metadata file
but something isn't really working!
The loop i'm using is this (in SLURM)
#SBATCH --export=ALL # export all environment variables to the batch job
#SBATCH -D . # set working directory to .
(...)
# Commands
module load BWA/0.7.17-foss-2018a
module load SAMtools/1.3.1-foss-2018a
module load BCFtools/1.6-intel-2017b
reference=/gpfs/ts0/home/jn378/mussels/snp/genomes/gallo_v6.snail.svg
input_reads=/gpfs/ts0/home/jn378/mussels/snp/3.fastp
align=/gpfs/ts0/home/jn378/mussels/snp/5.bam-files
metadata=/gpfs/ts0/home/jn378/mussels/snp/SNP-array-metadata.txt
metadata=/gpfs/ts0/home/jn378/mussels/snp/SNP-array-metadata.txt
read1=( `cat $metadata | cut -f 4` )
read1_array=$input_reads/${read1[(($SLURM_ARRAY_TASKID))]}
read2=( `cat $metadata | cut -f 5` )
read2_array=$input_reads/${read2[(($SLURM_ARRAY_TASKID))]}
outbam=( `cat $metadata | cut -f 1` )
out=${outbam[(($SLURM_ARRAY_TASKID))]}
echo "reference" $reference
echo "read1" $read1_array
echo "read2" $read2_array
echo "alignment" $align/${out}_unsorted.raw.sam
#### Align with bwa mem ###
####bwa mem -t 4 $reference $read1_array $read2_array > ${align}/${out}_unsorted.raw.sam
but I keep getting this error:
bwa.sh: line 34: (()): syntax error: operand expected (error token is "))")
Could someone help me with this issue?
Many thanks!
The error message you get
bwa.sh: line 34: (()): syntax error: operand expected (error token is "))")
is because the variable you want to use is named SLURM_ARRAY_TASK_ID and not SLURM_ARRAY_TASKID. The latter is not set and the expression expands to
read1_array=$input_reads/${read1[(())]}
which Bash cannot parse.
So replace SLURM_ARRAY_TASKID with SLURM_ARRAY_TASK_ID and it should be ok.
Also note that the double parentheses are not needed, and it is always a good idea to double quote variables of paths in case some contain special chars, so you can write
read1_array="$input_reads/${read1[$SLURM_ARRAY_TASK_ID]}"

The exit status code for the 'grep' command

The grep manual at the exit status section report:
EXIT STATUS
The exit status is 0 if selected lines are found, and 1 if not
found. If an error occurred the exit status is 2. (Note: POSIX
error handling code should check for '2' or greater.)
But the command:
echo ".
..
test.zip"|grep -vE '^[.]'
echo $?
echo "test.zip
test.txt"|grep -vE '^[.]'
echo $?
The value returned is always 0. I would have expected 1 and 0. What am I doing wrong?
Remember that grep is line based. If any line matches, you got a match. (In your first case test.zip matches (more precisely: you used with -v therefore you have asked for lines that do not match your pattern, and test.zip does exactly that, i.e. does not match your pattern. As a result your grep call was successful). Compare
$ grep -vE '^[.]' <<<$'.\na'; echo $?
a
0
with
$ grep -vE '^[.]' <<<$'.\n.'; echo $?
1
Note how the first command outputs the line a, that is it has found a match, which is why the exit status is 0. Compare that with the second example, where no line was matched.
References
<<< is a here string:
Here Strings
A variant of here documents, the format is:
[n]<<<word
The word undergoes brace expansion, tilde expansion, parameter and
variable expansion, command substitution, arithmetic expansion, and
quote removal. Pathname expansion and word splitting are not per-
formed. The result is supplied as a single string, with a newline
appended, to the command on its standard input (or file descriptor n if
n is specified).
$ cat <<<'hello world'
hello world
$'1\na' is used to get a multi line input (\n is replaced by newline within $'string', for more see man bash).
$ echo $'1\na'
1
a

Run command on GPS fix

I have GPSD running on a Linux system (specifically SkyTraq Venus 6 on a Raspberry Pi 3, but that shouldn't matter). Is there a way to trigger a command when the GPS first acquires or loses the 3D fix, almost like the scripts in /etc/network/if-up.d and /etc/network/if-down.d?
I found a solution:
Step 1: With GPSD running, gpspipe -w outputs JSON data, documented here. The TPV class has a mode value, which can take one of these values:
0=unknown mode
1=no fix
2=2D fix
3=3D fix
Step 2: Write a little program called gpsfix.py:
#!/usr/bin/env python
import sys
import errno
import json
modes = {
0: 'unknown',
1: 'nofix',
2: '2D',
3: '3D',
}
try:
while True:
line = sys.stdin.readline()
if not line: break # EOF
sentence = json.loads(line)
if sentence['class'] == 'TPV':
sys.stdout.write(modes[sentence['mode']] + '\n')
sys.stdout.flush()
except IOError as e:
if e.errno == errno.EPIPE:
pass
else:
raise e
For every TPV sentence, gpspipe -w | ./gpsfix.py will print the mode.
Step 3: Use grep 3D -m 1 to wait for the first fix, and then quit (which sends SIGPIPE to all other processes in the pipe).
gpspipe -w | ./gpsfix.py | grep 3D -m 1 will print 3D on the first fix.
Step 4: Put in in a bash script:
#!/usr/bin/env bash
# Wait for first 3D fix
gpspipe -w | ./gpsfix.py | grep 3D -m 1
# Do something nice
cowsay "TARGET LOCATED"
And run it:
$ ./act_on_gps_fix.sh
3D
________________
< TARGET LOCATED >
----------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||

Error in creating simulator build for facebook submission for review zip

When I try to create simulator build, it will show this error:
Admins-Mac-mini:~ admin$ ditto -ck --sequesterRsrc --keepParent `ls -1 -d -t ~/Library/Developer/Xcode/DerivedData/*/Build/Products/*-iphonesimulator/*.app | head -n 1` /Users/admin/Documents/Projects/bam.zip
**ditto: Can't archive multiple sources**
**Usage: ditto [ <options> ] src [ ... src ] dst**
Admins-Mac-mini:~ admin$
How can I resolve it?
Solution 1:
if you directory name has space(s) then command will not work. don't forget to add escape character before space. I have note-down whole command which has destination directory name(untitled folder) with space character.
ditto -ck --sequesterRsrc --keepParent `ls -1 -d -t ~/Library/Developer/Xcode/DerivedData/*/Build/Products/*-iphonesimulator/*.app | head -n 1` /Users/imediaimac/Desktop/untitled\ folder/test.zip
given command works properly without any problem.
Solution 2:
Step 1: open finder and press command⌘ + shift⇧ + g
Step 2: paste "~/Library/Developer/Xcode/DerivedData"
Step 3: select your_app_name-jkfksdfhskdhfksdh some thing like this folder
Step 4: your_app_name-jkfksdfhskdhfksdh >>Build >>Products>>Debug-iphoneos
Step 5: You will see 2 files one is your_app_name.app(icon like rounder and 1 cross line ) and 2nd file is your_app_name.app.dSYM
Step 6: To create .zip file right click on your_app_name.app and select "Compress your_app_name". It will generate .zip file and submit it to facebook.
For more details visit Facebook official documentation here.
This has solved same issue. Remove whitespace/space from .app name
ditto -ck --sequesterRsrc --keepParent ls -1 -d -t /Users/company/Desktop/Build/appname.app | head -n 1 /Users/company/Desktop/Build/appname.zip

unable to get pylint output to populate the violations graph

my build steps:
cd $WORKSPACE
export TERM="linux"
. venv/bin/activate
pylint --rcfile=pylint.cfg $(find handlers -maxdepth 1 -name "*.py" -print) > pylint.log || exit 0
result of pylint.log:
************* Module handlers
C: 1, 0: Missing module docstring (missing-docstring)
C: 8, 0: Missing function docstring (missing-docstring)
************* Module handlers.foo
C: 1, 0: Black listed name "foo" (blacklisted-name)
C: 1, 0: Missing module docstring (missing-docstring)
C: 1, 0: Missing function docstring (missing-docstring)
E: 2,11: Undefined variable 'a' (undefined-variable)
E: 2,13: Undefined variable 'b' (undefined-variable)
Report
======
...
(the report continues with statistics by type, raw metrics, external dependencies)
the xml filename pattern for pylint is:
**/pylint.log
with the source path pattern being:
**/
Even after all this, and with pylint.log showing I have lint errors, the graph shows nothing.
any ideas how to get pylint and the violations plugin working nicely together?
it seems the correct pylint command is the following:
pylint --rcfile=pylint.cfg $(find handlers -maxdepth 1 -name "*.py" -print) --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > pylint.log || exit 0
note the addition of the --msg-template param
I had this problem myself. I think it was a result of the way I installed the Violations plugin. It worked after restarting Jenkins:
$ sudo service jenkins restart

Resources