Access denied to /dev/ttyUSB0

Enrique Hernández Bello ehbello at gmail.com
Wed Sep 7 23:29:03 UTC 2016


Hello,

taking advantage of this thread, what is the right way to grant access
of a /dev/ttyS0 to our snap in Ubuntu Core 16?

Regards.

2016-09-07 15:26 GMT+01:00 Simon Fels <simon.fels at canonical.com>:
> On 07.09.2016 15:05, Loïc Minier wrote:
>> Hi,
>>
>> You need to use:
>>
>> plugs: [serial-port]
>>
>> In your snapcraft.yaml; then you also have to connect your snap to that
>> interface manually as it's not autoconnected; check "snap interfaces" to
>> see which plugs and slots are connected.
>
> That doesn't work anymore. There is no implicit slot for serial-port.
> Right now the only option to get access to serial ports is via defining
> a slot on a gadget snap with either a USB product/vendor id pair or a
> absolute path to the serial node which then the snap can connect to and
> it will only get access to that particular serial port.
>
> You can put something like
>
> slots:
>   my-usb-serial-device:
>     interface: serial-port
>     product-id: 0x0
>     vendor-id: 0x0
>
> into your gadget snap and then connect both the snap and gadget together
> so your app gets access to that serial node.
>
> In a system where no gadget exists you currently don't get access to
> serial nodes. We need to implement hotplut support to make this slots
> automatically exported for those devices. Not sure for when this is on
> the list.
>
> regards,
> Simon
>
>>
>>
>> On Wed, Sep 7, 2016 at 4:00 PM, Jenny Murphy <jenny.murphy at episensor.com
>> <mailto:jenny.murphy at episensor.com>> wrote:
>>
>>     Hi,
>>      I solved the previous issue regarding the use of the RXTX java
>>     library and the application is loading and running without errors.
>>     However my java code isn't detecting the port, it should be able to
>>     see /dev/ttyUSB0.
>>
>>     In the dmesg log I see the following errors :
>>
>>     [101043.875139] usb 1-2: new full-speed USB device number 7 using
>>     xhci_hcd
>>     [101044.006418] usb 1-2: New USB device found, idVendor=10c4,
>>     idProduct=ea60
>>     [101044.006441] usb 1-2: New USB device strings: Mfr=1, Product=2,
>>     SerialNumber=3
>>     [101044.006456] usb 1-2: Product: CP2102 USB to UART Bridge Controller
>>     [101044.006470] usb 1-2: Manufacturer: Silicon Labs
>>     [101044.006482] usb 1-2: SerialNumber: 0001
>>     [101044.011589] cp210x 1-2:1.0: cp210x converter detected
>>     [101044.012037] usb 1-2: cp210x converter now attached to ttyUSB0
>>
>>     [101098.191960] audit_printk_skb: 258 callbacks suppressed
>>
>>     [101098.191979] audit: type=1400 audit(1473254849.416:69078):
>>     apparmor="DENIED" operation="open"
>>     profile="gateway.sideload_main_IdNRFcRcGPGe" name="/dev/ttyUSB0"
>>     pid=4875 comm="java" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
>>
>>
>>     Is there anyway to solve this. I am working on a Ubuntu 15.04 platform.
>>
>>     Thanks again.
>>
>>     --
>>     *Jenny Murphy*
>>     *EpiSensor, Georges Quay House, Georges Quay, Limerick, Ireland*
>>     jenny.murphy at episensor.com <mailto:jenny.murphy at episensor.com>  t |
>>     +353 (0) 61 512 511 <tel:%2B353%20%280%29%2061%20512%20511>  w |
>>     http://www.episensor.com <http://www.episensor.com/>
>>
>>     --
>>     Snapcraft mailing list
>>     Snapcraft at lists.snapcraft.io <mailto:Snapcraft at lists.snapcraft.io>
>>     Modify settings or unsubscribe at:
>>     https://lists.ubuntu.com/mailman/listinfo/snapcraft
>>     <https://lists.ubuntu.com/mailman/listinfo/snapcraft>
>>
>>
>>
>>
>> --
>> - Loïc
>>
>>
>
>
> --
> Snapcraft mailing list
> Snapcraft at lists.snapcraft.io
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft




More information about the Snapcraft mailing list