Skip to content

remote provisioning

Tim Bart edited this page Apr 23, 2015 · 29 revisions

##Provisioning Sense remotely

  • Endpoint: https://provision.hello.is
  • Path: /v1/provision/SN
  • Content-Type : text/plain

Example

curl https://provision.hello.is/v1/provision/SN123 -X POST -d'72352A810071464CFD94484BD3CBCFF5461195E1F30D3479E3833F6DCBD877F63D3C76CF0D6C5D931428BDD4E72E06ED34A0F18A066DD6A3A92BB5C946FDEEEA1B8399C24A1A2FBEE0EDE3878A1EA693D9E2F0125616676BB4DA7133CA8B241E3513383C7FD98A6D4D650A53A94918880D8213B7E0610ED6CD372152184CC035' -H 'Content-Type: text/plain'

If success, returns HTTP 200:

OK
56435B07B053AF4E // device_id for visual confirmation

else: HTTP 500

HTTP/1.1 500 Internal Server Error
Content-Type: application/octet-stream
Date: Sun, 25 Jan 2015 23:36:16 GMT
Server: nginx/1.4.1
Content-Length: 3
Connection: keep-alive

404

Notes

  • this is only as available as our DNS record, ELB, application and DynamoDB. There are many things that can fail. We’ll add redundancy as time permits.

  • motorola scanners need to be programmed to produce an endline, can scan codes from motorola-ls-ds-3508-3578-carriage-return.pdf

  • script clocked at ~20 seconds when the server already has the key, and ~40 seconds when the key must be generated.

  • todo post pvt:

  • add a batch upload so that the server can assign a mac address in the reply

Laptop setup

We are using G40-30 and ubuntu 14.10

Need to load ideapad kernel module to get wifi working:

hello@hello-pch:~$ cat /etc/rc.local
#!/bin/sh -e
sudo modprobe -r ideapad-laptop
sudo rfkill unblock all
rfkill list all

exit 0

Need to add a rule for the FTDI cable:

hello@hello-pch:~$ cat /etc/udev/rules.d/10-ftdi.rules
BUS!="usb", ACTION!="add", SUBSYSTEM!="usb", GOTO="ftdi_rules_end"

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6001, MODE:="0666", GROUP="plugdev"

LABEL="ftdi_rules_end"
hello@hello-pch:~$ 

Need to add the current user to plugdev:

sudo usermod -a -G plugdev hello
sudo usermod -a -G dialout hello

And setup NTP:

sudo apt-get install ntp

Change colors for terminal to help prevent operator eye strain. Open the terminal and go to edit->preferences->colors and set background to green and text to grey. This lowers the contrast.

Set display to not time out. Go to all settings->light locker settings and disable light locker.

At the beginning of every boot, run putty or other terminal programs to flush out the uart buffer, otherwise the script wouldn't be able to start properly(stuck in tx/rx)

Router setup

We use a link sys e1200v2 with dd-wrt.v24-25974_NEWD-2_K2.6_mini-e1200v2.bin loaded.

DNS setup to point the morpheus at the laptop:

Other router setup:

https://www.dropbox.com/sh/553r01rusf9dofd/AADI1HfHIaEuDxtAB3mXgQpta?dl=0

##Provisioning script

Script is located in github at hello/factory-tests-scripts