0%

Checking for existing SSH Keys[1] [2]

1
2
$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
If you don’t already have an SSH key, generating a new SSH key and adding it to the ssh-agent
1
2
3
4
5
6
7
8
cd ~/
mkdir .ssh ; cd .ssh

# Make sure that the file permissions are set to read/write/execute only for the user
chmod go-rwx .ssh

# substituting in your GitHub email address.
ssh-keygen -t ed25519 -C "your_email@example.com"

Check:

1
2
3
4
5
6
ls -al
total 16
drwxr-xr-x 4 luohanjie staff 128 12 13 16:28 .
drwxr-x---+ 28 luohanjie staff 896 12 13 16:25 ..
-rw------- 1 luohanjie staff 411 12 13 16:28 id_ed25519
-rw-r--r-- 1 luohanjie staff 101 12 13 16:28 id_ed25519.pub

Adding your SSH key to the ssh-agent

Start the ssh-agent in the background:

1
2
eval "$(ssh-agent -s)"
Agent pid 2421

If you’re using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain:

1
2
3
4
5
open ~/.ssh/config
The file /Users/luohanjie/.ssh/config does not exist.

# If the file doesn't exist, create the file.
touch ~/.ssh/config

Open your ~/.ssh/config file, then modify the file to contain the following lines. If your SSH key file has a different name or path than the example code, modify the filename or path to match your current setup.

Note: If you chose not to add a passphrase to your key, you should omit the UseKeychain line.

1
2
3
4
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519

Add your SSH private key to the ssh-agent and store your passphrase in the keychain. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.

Note: The -K option is Apple’s standard version of ssh-add, which stores the passphrase in your keychain for you when you add an SSH key to the ssh-agent. If you chose not to add a passphrase to your key, run the command without the -K option.

If you don’t have Apple’s standard version installed, you may receive an error. For more information on resolving this error, see “Error: ssh-add: illegal option – K.”

In MacOS Monterey (12.0), the -K and -A flags are deprecated and have been replaced by the --apple-use-keychain and --apple-load-keychain flags, respectively.

1
ssh-add -K ~/.ssh/id_ed25519

Adding a new SSH key to your GitHub account

Copy the SSH public key to your clipboard:

1
pbcopy < ~/.ssh/id_ed25519.pub

In the upper-right corner of any page, click your profile photo, then click Settings.

Setting

In the user settings sidebar, click SSH and GPG keys. Click New SSH key or Add SSH key. Paste your key into the “Key” field. Click Add SSH key. If prompted, confirm your GitHub password.


  1. https://docs.github.com/en/authentication/connecting-to-github-with-ssh ↩︎

  2. https://wpbeaches.com/generate-ssh-private-and-public-keys-in-macos-big-sur/ ↩︎

Setting Environment Variables

Open a shell and make sure there exist an NDK global variable set to the directory where you extracted the NDK.

1
2
3
4
5
sudo gedit ~/.bashrc

export ANDROID_SDK=<path to Android SDK directory>
export ANDROID_NDK=<path to Android NDK directory>
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK
1
2
3
4
5
6
7
8
9
source ~/.bashrc
ndk-build --version

GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Building
1
cd /libusb/android/jni

ndk-build 的默认值为 none。
您可以使用 Application.mk 文件中的 APP_STL 变量指定 c++_shared、c++static、> none 或 system。例如:
APP_STL := c++_shared
ndk-build 仅允许为您的应用选择一个运行时,并且只能在 Application.mk 中进行选择。

由于我们希望使用c++_shared,所以我修改/libusb/android/jni/Application.mk文件,添加APP_STL := c++_shared

1
ndk-build

AR系统中存在虚拟影像空间和现实世界空间两个空间。在实际使用中,我们要求虚拟影像空间与现实世界空间能够对齐,使得虚拟物体与实际物体能够正确地叠加在一起。这需要我们对AR眼镜进行标定,获得传感器与光学屏幕,人眼之间的几何关系[1]

ar_glasses_calibration1


  1. Cutolo, F., Fontana, U., Cattari, N. and Ferrari, V., 2020. Off-line camera-based calibration for optical see-through head-mounted displays. Applied Sciences, 10(1), p.193. ↩︎