Google Coral serial number - google-coral

I need a unique identifier of my device and on Raspberry PI I could get a serial number of the cpu from the /proc/cpuinfo file. But on Coral there is no serial information in /proc/cpuinfo.
Are there any other ways to uniquely identify my device? What about /etc/machine-id?

Following Florian's answer here, using the ATECC608A serial is an option as NXP's serial on the SOC is hard to access.
The coral's cloudiot package has a wrapper around cryptoauthlib sdk to get the serial number.
Install coral's cloudiot:
echo "deb https://packages.cloud.google.com/apt coral-cloud-stable main" | sudo tee /etc/apt/sources.list.d/coral-cloud.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt update
sudo apt install python3-coral-cloudiot
Get Serial Number:
python3 -c 'from coral.cloudiot.ecc608 import ecc608_serial; print("ATECC608A Serial:", ecc608_serial())'

Reply from Google support
NXP SoC has a unique serial number which could be read from sw.
It is suggested to check IMX8M reference manual for that information.
That approach will require you to add/modify kernel driver to expose that SN via sysfs node.

There is another option of getting an ID from the board. The SoM of the Coral Dev Board also features a built-in cryptochip which offers a unique ID you can use. There was a discussion together with some python code on how to use it here:
How to use the crypto processor on the dev board?
I havent tried yet, if the serial number of the ecc608 can also be accessed by file system means. The ecc608 is available on the 0th I2C bus of the system.

Related

Why there is different versions of openCV packages on Anaconda website? Which one should I install? [duplicate]

When searching a package in Anaconda Cloud, there are often multiple commands one could use to install a package. For example,
conda install -c conda-forge xxx
conda install -c conda-forge/label/gcc7 xxx
conda install -c conda-forge/label/cf201901 xxx
What's the difference between them?
Labels
Channel maintainers have an option to add labels to their package builds. Anaconda Cloud suggests using labels as a tool for organizing the development cycle. What the labels mean is totally up to the channel maintainer, so there's no general answer that will cover it all. When a label isn't provided, then default main is assigned.
Only advanced users should ever need to use a label. Most users should simply use the default specification:
conda install -c conda-forge xxx
Example: gcc7
Let's look at a specific use case taken from your example. The gcc7 label is used by the Conda Forge channel maintainers to designate packages that have been compiled under a different toolchain than the packages they provide under their main tag. This gcc7 toolchain is designed to more closely match that which is used by the official channels (what you'd get from -c defaults) and thereby yield binaries that are compatible. You can read all about it in this issue on the Conda Forge repo.

How to use the crypto processor on the dev board?

On the data sheet, the SoM comes with an ATECC608A crypographic coprocessor, but there are no documentations on how to use it. Are there some usecase for this HW and any instructions on how to use it?
This library is included in the coral-cloud repo. It is generally installed with the Coral cloudiot package (python3-coral-cloudiot) but could also directly installed with python3-cryptoauthlib.
echo "deb https://packages.cloud.google.com/apt coral-cloud-stable main" | sudo tee /etc/apt/sources.list.d/coral-cloud.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt update
sudo apt install python3-coral-cloudiot
The sdk can be found here: https://github.com/MicrochipTech/cryptoauthlib
The internal ECC608 seems to be connected to the internal i2c (I2C1). The external i2c busses are I2C2 and I2C3.
If adapted to bus I2C1 (bus 0), the example code finds an ECC608 at address 0x60 on my device and I can read out the serial number of the chip.
Although - the ECC608 has many configuration and key-storage options. If haven't found any documentation on the internal use of the chip yet.

socat struggle to create serial ports

For testing purposes I want to use socat to create virtual serial ports to use in my Python program.
I have limited success, but struggle again and again with the many options in socat. I use this command in Ubuntu Linux:
sudo socat -d -d pty,b9600,raw,echo=0,link=/dev/ttyS90 pty,b9600,raw,echo=0,link=/dev/ttyS91
As it should, it creates the virtual ports like /dev/pts/2 and 4, and links them to /dev/ttyS90 and *91. It does not work without sudo (it fails with unable to unlink for the *90, *91 ports, although the regular user is in the dialout group).
But as you see the permissions 'lrwxrwxrwx' look like reading/writing for everybody. However, this is NOT true: I CANNOT use these devices unless I am root. The file manager (=Nemo) gives this result:
The permissions are significantly different. Huh?
After issuing 'sudo chmod 777 /dev/ttyS90' (and same for *91) nothing changes in the terminal output, because it is already, but incorrectly, showing 777 permissions, but the Nemo output changes to
And now I can use the ports as regular user! How comes? Am I doing something wrong?
And one more socat problem: the above socat command gives an 8-bit, no-parity connection, but I really need a 7-bit, even-parity connection. My attempts to implement this by juggling some of the many options all failed. I am lost; any insight?
Try changing the permission on /dev/pts/2 and /dev/pts/4 instead of on the link

IBM Blockchain - Simple Application

Alright, I need to develop a simple application in an IBM Blockchain(starter plan). But I can't get it done, after almost 1 month of trial and error and thousands of tutorials.
So, my case is really simple(I guess):
I have a models.cto file:
namespace com.test.models
/**
* A company asset.
*/
asset Company identified by company_id {
o String company_id
o String document_key
o String document_value
o String name
o String telephone
o String email
}
/**
* A person_in_charge asset.
*/
asset PersonInCharge identified by person_in_charge_id {
o String person_in_charge_id
o String company_id
o String name
o String document_key
o String document_value
o String email
o String language
o String created_date_time
}
I tried to make it as participant instead. I tried to make transaction and then do something with .js file but there are only use cases and tutorials about complex examples using assets, participants, etc. I just want to insert "PersonInCharge" and "Company" separately and query (each Company or by id whatever) also separately.
I was able to made a example using Swagger api generator, but it didn't worked as expected, even thought it created all the methods I wanted, like this:
For summarize, I wanted to deploy my chaincode in a peer, inside of a channel at IBM Blockchain. I did deployed a marble example and it did worked perfectly.
Really self describing error, not with a general message:
I am following a "how to" guide for develop locally and deploy to IBM. Therefore, I am creating a bna file composer archive create -t dir -n . and then creating a card with the downloaded connection settings(from IBM) and else using this tutorial Deploying a business network on Starter Plan
and I am failing at this step: composer network start -c adminCard -n bna-blockchain -V 0.0.1 -A admin -C ./credentials/admin-pub.pem -f delete_me.card. perhaps beucause I'm not being able to instantiate my chaincode on IBM Blockchain.
Sorry if it looks confunsing, just ask me if you have any questions about my issue.
Thanks in advance and any help would be awesome!
Before starting the network, you need to install it:
composer network install -c adminCard -a vehicle-manufacture-network.bna
I took a break in the development and came back after a month. In that time, I had help of a person inside IBM who could help me to get it done.
And I'm here so point out, some failures too.
The IBM guy(I won't say his name, of course) itself said that the service to upload a chaincode(channels/chaincode/Install chaincode) is broken and does not work well.
Also, I asked an easy to answer question in the IBM Blockchain paid forum but had no help at all(they did not even answer the question), even after almost 3 months. And you can't find a tutorial(besides marbles samples) that works from start to end.
Sorry if it looks like I'm raging for nothing in here, but I had a really hard time to put it all together to work 100%.
I will not show how to create a model file or transactional scripts(because there are a plenty of it on examples) but the commands you need to execute in order to run the chaincode on IBM and generate a loopback API. With that said...
Let's go to what's important: the code
First things first, Environment settings:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
IMPORTANT: IBM Blockchain(until now 2019-03-23) won't run under virtualized machines like virtual box or hyperv because of a couple npm dependencies. But a hardware virtual machine(HVM) like amazon ones will do just fine.
STEPS
Install node and npm(follow the versions strictly as listed)
node -v
v8.15.1
npm -v
6.4.1
curl -O https://hyperledger.github.io/composer/unstable/prereqs-ubuntu.sh
chmod u+x prereqs-ubuntu.sh
./prereqs-ubuntu.sh
npm install -g --unsafe-perm composer-cli#0.20.5
npm install -g --unsafe-perm composer-rest-server#0.20.5
composer-rest-server -v
v0.20.5
composer -v
v0.20.5
Create a project using hyperledger composer-playground. Export it and navigate through the root directory of the project you just downloaded(the project can be developed locally too).
Download the connection settings file at IBM Blockchain(Overview/Connection Profile/Download) and name it as connection-profile.json. Find the node registrar, you'll use it to create the cards.
Run npm install. If anything goes wrong while installing the dependencies, check if you're using exactly the same versions that I am using. If you're not, uninstall it all and start again from the beginning.
tricky zone
composer card create -f ca.card -p connection-profile.json -u admin -s *your-password*
composer card import -f ca.card -c ca
composer identity request --card ca --path ./credentials -u admin -s *your-password*
You'll see that the credentials folder were generated. Inside this folder, find
the file admin-pub.pem (credentials/admin-pub.pem) copy the whole content of it, and then upload it to IBM Blockchain(Members/Certificates/Add Certificate). You'll be prompted to restart peers, click "yes"
After the peers come back online, in the same Certificates tab, find the certificate you just add, in the ACTION column click at the menu, and then choose the option "Sync Certificate".
composer archive create -t dir -n .
composer card create -f adminCard.card -p connection-profile.json -u admin -c ./credentials/admin-pub.pem -k ./credentials/admin-priv.pem --role PeerAdmin --role ChannelAdmin
composer card import -f ./adminCard.card -c adminCard
composer network install -c adminCard -a bna-name#version.bna
composer network start -c adminCard -n *bna-name* -V *bna-version* -A admin -C ./credentials/admin-pub.pem -f delete_me.card (Output: Successfully created business network card: Filename: delete_me.card)
composer card create -n *bna-name* -p connection-profile.json -u admin -c ./credentials/admin-pub.pem -k ./credentials/admin-priv.pem (Output file: admin#*bna-name*.card)
composer card import -f ./admin#*bna-name*.card (Card file: ./admin#*bna-name*.card Card name: admin#*bna-name*)
Now you'll generate the rest api using (automatically generated using swagger)
composer-rest-server -c admin#*bna-name* -n never -w true -p 8080
Enjoy!

Fedora 19 - Not able to establish Wi-Fi connection

currently I am using Fedora 19 (since a few days) but the setup of Wi-Fi let me going crazy. I'm using the Realtek RTL 8192CU Wi-Fi-adapter usb-dongle. Fedora recognizes my network, I enter the right password and using the correct encryption option, but the system still asking for the password.
Does anyone has a solution for my problem?
Thanks for your help.
Run yum update to make sure your system is up to date. Run yum install #'Developer Tools' if you have not previously installed the GNU build tools.
Download the latest drivers from Realtek (Version 3.4.4_4749)
Download this patch.
Extract the driver. In the directory "driver," there is another zip, extract that as well. Finally put the patch in that folder.
CD into the zip you extracted from the command line and type:
patch -p1 < use_kthread_run.patch
Type make, followed by make install. Finally you need to run modprobe 8192cu. You may also want to blacklist the previous driver.
Check /var/log/messages for NetworkManager messages. You should see what is failing there.

Resources