0

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?

0

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

  • Does chromium offer any way to pull that variable and use it? – hunter Nov 21 '16 at 19:53
  • I doubt chromium would have such specialized functionality OOB. Moreover I'd think it would be a security problem the browser was able read arbitrary (system) files when requested by a page (via javascript). – Shreyas Murali Nov 21 '16 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.