cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Custom SNAP access to USB/Serial port "/dev/ttyACM0"

Custom SNAP access to USB/Serial port "/dev/ttyACM0"

Akra
Member

Hello,

I need to access serial port using a custom snap without activating it via Node-RED to connect RS485 device with Serial to USB Adapter. As I understand, currently it's not possible without root privileges and in that case we are not allowed to use it in real project. Is it planned to add such rights in the future without granting root access to the device? 

Akra_0-1705973374037.png

Thank you for your support!

 

Best Regards,

Alex

 

5 REPLIES 5

MauroRiboniMX
Contributor

Hello,

If you make a custom  app the "serial-port" plug is what you need. Please try to make an app and see if the "serial-port" plug is connected. You can check it if you have SSH access with "sudo snap connections snapname".

bostroemc
Occasional Contributor

To follow up on Mauro's answer, I find it helpful to inspect (for example, using 7-zip) the snapcraft.yaml of existing snaps to see how the plugs are used:

node-red_snapcraft_yaml.png

Hello, finally could get back to this topic,

Can connect with Node-red and read registers from Modbus RTU slave. But no success with custom snap without root access, you need to connect raw-usb for that (need sudo), tried to bypass it by adding system-files interface, but it is also blocked by Ctrlx.

Akra_0-1709258898895.png

 

 

nickH
Community Moderator
Community Moderator

Hi @Akra 

sorry, but I'm not sure if I understand you correctly. You want to access some device via USB. From Node-Red it works but from a self created snap it does not work, right? 

Like @bostroemc mentioned you can look at the plugs which are connected to the Node-Red snap by unzipping it. Here you can see that the Node Red App uses the interface "serial-port". Therefor this should be also enough for your snap.

Best regards, 

Nick 

bostroemc
Occasional Contributor

Just one more comment:  As far as I know, daemons ALWAYS have root access within their area of confinement.  (See, for example, comments by ogra here.)  If you have configured your app to run as a daemon - the typcial use-case for ctrlX CORE - then access generally is a question of broadening the area of confinement via the plugs mechanism (i.e. setting up the plugs correctly) and never one of "sudo".

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist