I have been trying to use my Linux Mint computer with Visual Studio Code and have not been able to get the Photon 2 to connect and flash projects to it.
When I run $ lsusb
Bus 001 Device 002: ID 2b04:c020 Particle P2
When I try to flash the project it states it can not find the device.
I also tried to open the serial monitor and it "failed to open the serial port" It shows under the port list /dev/ttyACM0 - Particle
It appears that the computer sees the Photon 2, it just will not allow for the communications.
Does anyone have any tips to get past this ?
What are the permissions on /dev/ttyACM0? By default on Linux, it's only available to the root user.
You can either use a udev rule or you can just change the permissions on the device.
To use the udev method, download the 50-particle.rules file, then copy it to /etc/udev/rules.d.
sudo cp 50-particle.rules /etc/udev/rules.d/
You'll probably need to restart.
I added the rules to udev and no luck so far even after a shutdown and restart.
Looks like permissions are still under root only
MINT-LAPTOP:~$ ls -l /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Aug 8 15:16 /dev/ttyACM0
uid=1000(jake) gid=1000(jake) groups=1000(jake),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),114(lpadmin),134(sambashare)
I have tried to add the permissions from
sudo usermod -aG dialout $ jake
That has not been working. I found a thread in the Linux Mint Forum on this which says to use
sudo chown <username> /dev<device name eg. /dev/ttyACM0>
I have not been able to get that to work as I do not know what I need for device name. I will keep trying tonight.
The udev rule doesn't change the permissions on the device, but it still should allow it to work. See if
particle usb list
bash-5.0$ particle usb list
particle usb list: ../src/node_api.cc:1304:napi_status napi_release_threadsafe_function(napi_threadsafe_function, napi_threadsafe_function_release_mode): Assertion `(func) != nullptr' failed.
1: 0xb090e0 node::Abort() [particle usb list]
2: 0xb0915e [particle usb list]
3: 0xad32da napi_release_threadsafe_function [particle usb list]
4: 0x7f26d09b2be8 Device::Close(Napi::CallbackInfo const&) [/home/jake/.particle/node_modules/particle-cli/node_modules/usb/prebuilds/linux-x64/node.napi.glibc.node]
5: 0x7f26d09bb4fa Napi::InstanceWrap<Device>::InstanceMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [/home/jake/.particle/node_modules/particle-cli/node_modules/usb/prebuilds/linux-x64/node.napi.glibc.node]
6: 0xab380d [particle usb list]
7: 0xd3df3e [particle usb list]
8: 0xd3f35f v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [particle usb list]
9: 0x15d9ef9 [particle usb list]
Are you using node 22? You may be experiencing this problem.
You may want to use nvm or fnm to be able to quickly switch node versions when using the Particle CLI. Node 16 is recommended.
I do not know what node I am on. I was able to use "screen" to monitor the serial port, so that is working. I will look at that link and try that. Thanks again for all the help!