Serial Port Plug/Interface issue with Ubuntu-core 16.04 (#2557)

Mritunjai Singh mrsingh at ssni.com
Tue Jan 17 21:06:46 UTC 2017


Can anyone please guide me how to start writing gadget snap which gives me access to serial port interface on my Raspberry Pi board and x86_64 ubuntu machine.

Regards,
Mritunjai

From: Mritunjai Singh
Sent: Thursday, January 12, 2017 10:06 AM
To: 'Snapcraft' <snapcraft at lists.snapcraft.io>
Subject: RE: Serial Port Plug/Interface issue with Ubuntu-core 16.04 (#2557)

@Simon Fels, thanks for the pointer. It would be great if you can further guide me writing the gadget snap. I have a Ubuntu x86_64 machine(VM) to which I will be connecting our RF Mesh network card through USB. The network card connects over serial and exposes a /dev/ttys0 port to work with. So do I need to write gadget snap for my network card or for my Ubuntu machine on which I have already installed snapcraft.

Please guide and do let me know should you require any further information.

Regards,
Mritunjai

From: snapcraft-bounces at lists.snapcraft.io<mailto:snapcraft-bounces at lists.snapcraft.io> [mailto:snapcraft-bounces at lists.snapcraft.io] On Behalf Of Simon Fels
Sent: Thursday, January 12, 2017 12:58 AM
To: Snapcraft <snapcraft at lists.snapcraft.io<mailto:snapcraft at lists.snapcraft.io>>
Subject: Re: Serial Port Plug/Interface issue with Ubuntu-core 16.04 (#2557)

You can add a serial port slot to a gadget snap.yaml like this:

ttyS4:
  interface: serial-port
  path: /dev/ttyS4

This only applies to static serial port nodes. If you have one provided by an USB device you have to user a slightly different slot definition which refers the USB product/vendor id of your USB device:

my-usb-serial:
  interface: serial-port
  usb-product: 0x1111
  usb-vendor: 0x2222
  path: /dev/my-usb-serial-port

With the path attribute you can select a static path for the serial port node which your snap then gets access to once you connected the plug and the slot. The path needs to start with /dev/ and afterwards you're free to select a free node name. Internally the interface implementation will link the right /dev/ttyUSB* node to the specified path.

Please note that you can define such a slot only on a gadget snap! So if you don't have your own gadget snap today, you need to create one for your device in order to get access to the serial port.

I hope that helps.

regards,
Simon


On Wed, Jan 11, 2017 at 7:37 PM, Oliver Grawert <ogra at ubuntu.com<mailto:ogra at ubuntu.com>> wrote:
hi,
Am Mittwoch, den 11.01.2017, 17:59 +0000 schrieb Mritunjai Singh:
> Hi All,
>
> Kindly refer to: https://github.com/snapcore/snapd/issues/2557
>
> We are trying to get a head start on Core Snappy working with our RF
> Mesh network card. It connects over serial and needs to be available
> at boot. We first tried this using snap approach but due to missing
> hotplugging serial-interface in current(latest) version of snapcraft,
> serial i/o requests are being denied even if the snap has the
> permission to use serial port.
>
> We have been suggested the gadget snap approach in order to expose
> /dev/ttyS0 to the serial port interface for tunnccd snap to access
> it. It would be very helpful if someone can point me to the working
> example of a gadget snap with access to serial interface or any end
> to end gadget snap example and its build steps.

note that all our gadgets offer a console on serial by default, if you
drive some external device via serial you might want to drop this
console tty option.

all our official gadgets are under https://github.com/snapcore/ ..
namely the pi2-gadget, pi3-gadget, pc-gadget and dragonboard-gadget
sub-trees if you want to take a look ...

ciao
        oli
--
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170117/4b7ef97b/attachment.html>


More information about the Snapcraft mailing list