Skip to content

Commit

Permalink
Add support for SoMs in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
monkbroc committed Jan 24, 2019
1 parent 4542fd4 commit ad044ce
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 17 deletions.
3 changes: 3 additions & 0 deletions src/cmd/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const PLATFORMS = extend(utilities.knownPlatforms(), {
'a': 12,
'b': 13,
'x': 14,
'a-series': 22,
'b-series': 23,
'x-series': 24,
'o': 82,
'd': 88,
'bl': 103,
Expand Down
18 changes: 3 additions & 15 deletions src/cmd/constants.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
const platformsByName = {
core: 0,
c: 0,
photon: 6,
p: 6,
p1: 8,
electron: 10,
e: 10,
duo: 88,
d: 88,
bluz: 103,
b: 103
};

const platformsById = {
0: 'Core',
6: 'Photon',
Expand All @@ -20,6 +6,9 @@ const platformsById = {
12: 'Argon',
13: 'Boron',
14: 'Xenon',
22: 'A Series',
23: 'B Series',
24: 'X Series',
31: 'Raspberry Pi',
88: 'Duo',
103: 'Bluz'
Expand All @@ -39,7 +28,6 @@ const notSourceExtensions = [
const MAX_FILE_SIZE = 1024 * 1024 * 2;

module.exports = {
platformsByName,
platformsById,
notSourceExtensions,
MAX_FILE_SIZE
Expand Down
162 changes: 161 additions & 1 deletion src/lib/deviceSpecs/specifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function deviceIdFromSerialNumber(serialNumber) {
}

const specs = {

// key is DFU id shown in dfu-util -l
'1d50:607f': {
productName: 'Core',
tcpServerKey: {
Expand Down Expand Up @@ -383,6 +383,59 @@ const specs = {
defaultProtocol: 'udp',
productId: 12,
},
'2b04:d016': {
productName: 'A Series',
tcpServerKey: {
address: '2082',
size: 512,
format: 'der',
alt: '1',
alg: 'rsa',
addressOffset: 384,
portOffset: 450
},
udpServerKey: {
address: '3298',
size: 320,
format: 'der',
alt: '1',
alg: 'ec',
variant: 'gen3',
addressOffset: 192,
portOffset: 258
},
tcpPrivateKey: {
address: '34',
size: 612,
format: 'der',
alt: '1',
alg: 'rsa'
},
udpPrivateKey: {
address: '3106',
size: 192,
format: 'der',
alt: '1',
alg: 'ec'
},
userFirmware: {
address: '0x000D4000',
alt: '0'
},
systemFirmwareOne: {
address: '0x00030000',
alt: '0'
},
knownApps: {
},
serial: {
vid: '2b04',
pid: 'c016',
serialNumber: 'Particle_Argon'
},
defaultProtocol: 'udp',
productId: 22,
},
'2b04:d00d': {
productName: 'Boron',
tcpServerKey: {
Expand Down Expand Up @@ -437,6 +490,59 @@ const specs = {
defaultProtocol: 'udp',
productId: 13,
},
'2b04:d017': {
productName: 'B Series',
tcpServerKey: {
address: '2082',
size: 512,
format: 'der',
alt: '1',
alg: 'rsa',
addressOffset: 384,
portOffset: 450
},
udpServerKey: {
address: '3298',
size: 320,
format: 'der',
alt: '1',
alg: 'ec',
variant: 'gen3',
addressOffset: 192,
portOffset: 258
},
tcpPrivateKey: {
address: '34',
size: 612,
format: 'der',
alt: '1',
alg: 'rsa'
},
udpPrivateKey: {
address: '3106',
size: 192,
format: 'der',
alt: '1',
alg: 'ec'
},
userFirmware: {
address: '0x000D4000',
alt: '0'
},
systemFirmwareOne: {
address: '0x00030000',
alt: '0'
},
knownApps: {
},
serial: {
vid: '2b04',
pid: 'c017',
serialNumber: 'Particle_Boron'
},
defaultProtocol: 'udp',
productId: 23,
},
'2b04:d00e': {
productName: 'Xenon',
tcpServerKey: {
Expand Down Expand Up @@ -490,6 +596,60 @@ const specs = {
},
defaultProtocol: 'udp',
productId: 14,
},

'2b04:d018': {
productName: 'X Series',
tcpServerKey: {
address: '2082',
size: 512,
format: 'der',
alt: '1',
alg: 'rsa',
addressOffset: 384,
portOffset: 450
},
udpServerKey: {
address: '3298',
size: 320,
format: 'der',
alt: '1',
alg: 'ec',
variant: 'gen3',
addressOffset: 192,
portOffset: 258
},
tcpPrivateKey: {
address: '34',
size: 612,
format: 'der',
alt: '1',
alg: 'rsa'
},
udpPrivateKey: {
address: '3106',
size: 192,
format: 'der',
alt: '1',
alg: 'ec'
},
userFirmware: {
address: '0x000D4000',
alt: '0'
},
systemFirmwareOne: {
address: '0x00030000',
alt: '0'
},
knownApps: {
},
serial: {
vid: '2b04',
pid: 'c018',
serialNumber: 'Particle_Xenon'
},
defaultProtocol: 'udp',
productId: 24,
}
};

Expand Down
3 changes: 3 additions & 0 deletions src/lib/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ const utilities = {
'argon': 12,
'boron': 13,
'xenon': 14,
'aseries': 22,
'bseries': 23,
'xseries': 24,
'oak': 82,
'duo': 88,
'bluz': 103,
Expand Down
2 changes: 1 addition & 1 deletion test/cmd/keys.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ describe('Key Command', function() {

describe('keyAlgorithmForProtocol', function() {
before(setupCommand);

it('returns rsa for TCP protocol', function() {
expect(key.keyAlgorithmForProtocol('tcp')).eql('rsa');
});
Expand Down

0 comments on commit ad044ce

Please sign in to comment.