It seems like you are trying to talk to bluez, which is different than what bluetooth-control provides. If you are on Ubuntu Core, you can install the bluez snap and your snap can then use ‘plugs: [ bluez ]’ to connect to it.
Note that the bluez interface is not available as an implicit classic slot at this time.
Is there a specific reason for this (I was wondering already during the day when @willdeberry asked on IRC) ?
If Bluetooth is available on classic it should just expose a bluez interface IMHO.
I also went through the path of installing the bluez snap on 16.04. It did not install a :bluez Slot. The only thing I found was bluez:service. See output of sudo snap interfaces below:
This is the slot. Your snap would ‘plugs: [ bluez ]’ and on the command line you would ‘snap connect bjarkan:bluez bluez:service’.
Note that installing the bluez snap on a classic system is probably not going to do what you want unless you remove the bluez deb. Also, on classic with the bluez snap you won’t necessarily have the same dbus bus policy and definitely won’t have polkit. I don’t recommend you pursue this for production deployments. The snap is designed for Ubuntu Core, not classic.
Better would be to adjust snapd to expose the slot on classic (see my last comment).
adjust the base declaration and adjust testsuite as appropriate
adjust to use ‘unconfined’ when OnClassic
add a test to bluez_test.go for when OnClassic (see TestAppArmorSpec() in avahi_observe_test.go)
You can quickly iterate with specific testsuite tests with:
$ go build -v github.com/snapcore/snapd/... && go test -v github.com/snapcore/snapd/interfaces/builtin
$ go build -v github.com/snapcore/snapd/... && go test -v github.com/snapcore/snapd/interfaces/policy
(first is for your interface changes, the second for the base declaration)
So I made the changes that I think are needed: https://github.com/willdeberry/snapd/commit/506c576926a1d1be02aa3a4f7af7ae3547c34d89
Ran the tests you suggested and all is passing. However, reading through the HACKING.md to build snapd and test it locally, I am still not seeing the :bluez interface.
Having not dealt with go before, not sure if I am missing something obvious.
I am building snapd and snap using the following commands: go build -o /tmp/snapd github.com/willdeberry/snapd/cmd/snapd go build -o /tmp/snap github.com/willdeberry/snapd/cmd/snap
I then stopped all other snapd services as advised by the docs: sudo systemctl stop snapd.service snapd.socket. Then launched my built snapd service: sudo SNAPD_DEBUG=1 SNAPD_DEBUG_HTTP=3 /tmp/snapd.
Nothing I do seems to show a newly exposed :bluez interface.