Kalapaja / kampela-firmware

Firmware sources and associated software projects for the Kampela hardware signer
https://kampe.la
GNU General Public License v3.0
4 stars 9 forks source link

Instructions for Debian & Frenz #27

Open nuke-web3 opened 4 months ago

nuke-web3 commented 4 months ago

Not everyone uses mac or arch :stuck_out_tongue: - further it's not super clean step-by-step how to actually start by cloning this repo and end up with a flashed & ready device... did I miss that?

(WIP will update as I figure it out, make a PR if sensible too)

nuke-web3 commented 4 months ago

After doing a fair amount of env setup and deps installs :vomiting_face: I get:

$ ./binarize.sh --pilkki

Preparing binary file...
Flashing...
No port specified, trying to autodetect...
Connecting to port "/dev/ttyACM0"
ERROR:
Failed to open Serial

The device is connected and showsup in lsusb and not sure how to proceed from here: https://github.com/Kalapaja/pilkki/blob/main/software/src/serial_unix.cpp#L19

Slesarew commented 3 months ago

After doing a fair amount of env setup and deps installs 🤮 I get:

$ ./binarize.sh --pilkki

Preparing binary file...
Flashing...
No port specified, trying to autodetect...
Connecting to port "/dev/ttyACM0"
ERROR:
Failed to open Serial

The device is connected and showsup in lsusb and not sure how to proceed from here: https://github.com/Kalapaja/pilkki/blob/main/software/src/serial_unix.cpp#L19

you might be missing repmissions to use port, something along the lines with https://wiki.archlinux.org/title/Udev#Allowing_regular_users_to_use_devices

(or just adding yourself to USB group, Ubuntu is always special about these things)

kirushik commented 3 months ago

@NukeManDan what's the output of your groups list?

IIRC, you'd need to be a member of a dialout group to use serial devices.

If this fails, one can set 0666 permissions on a specific device via udev rules...

Slesarew commented 3 months ago

dialout was for real serial devices, and this is USB to serial. So it must be some other group, maybe udev or something along the lines. All this stuff should is usually enabled once on embedded devs machines, so we really would appreciate input from newbies to remind everyone how that was done.

Slesarew commented 3 months ago

https://wiki.archlinux.org/title/Users_and_groups#User_groups so it might be uucp group too.

nuke-web3 commented 3 months ago

@NukeManDan what's the output of your groups list?

<my user's group> adm sudo plugdev lpadmin

I also use a trezor-like wallet that requires udev rules: https://github.com/keepkey/udev-rules

Sadly, mimicking the flow here doesn't seem to fix Failed to open Serial:

/usr/lib/udev/rules.d/52-usb-kampela.rules

# Kampela Developer USB Firmware Falsher
# https://www.kampe.la/
# Put this file into /usr/lib/udev/rules.d or /etc/udev/rules.d

# STMicroelectronics Virtual COM Port
SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="5740", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="kampela%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740",  MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"

Not sure if I am missing something else in this rule, as I have never created one before :see_no_evil:. I got the vendor and product from lsusb

Bus 003 Device 007: ID 0483:5740 STMicroelectronics Virtual COM Port
nuke-web3 commented 3 months ago

Also I see in the readme a mention of Segger - is that an alternative to Pilkki? It's not clear from just the readme, but seems like it could be looking at binariz.sh. I assume I would still have the same permissions issue with that option though, ya?