I'm looking for a way to pass in the Raspberry Pi serial number to Chromium when running from the command line.
chromium-browser --incognito --noerrdialogs http://url.com?sn={serial}
Is this possible?
2020-02-07 answer:
You can get the serial number with:
rpi ~$ cat /sys/firmware/devicetree/base/serial-number
10000000cd0297b1
So the command to call chromium on the command line with serial number resulted in:
rpi ~$ chromium-browser --incognito --noerrdialogs http://url.com?sn=$(cat /sys/firmware/devicetree/base/serial-number)
here is a related question.
Briefly, you could read the file /proc/cpuinfo
which would produce a listing like so
#cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 1
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 2
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 3
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
Hardware : BCM2709
Revision : a02082
Serial : 000000003d1d1c36
The last line should give you what you need.
you could use a
python script to read the serial number (as described in the link) and launch the chromium browser with the right argument using subprocess module (the linked question's answers have such examples)
if you commandline savvy awk
would give you a one liner