creates the notify callback. But it never triggers. On second connection the callback gets triggered, but the connect code gets run again so another refcount is added. This means the intr channel never gets closed which means it's stuck on the last event.
Ahhh...
I was already aware that on first connect the HID input device wasn't created, but I hadn't realised it's part of the same bug.
What's happening is that on initial connect:
dev->sec_watch = g_io_add_ watch(idev- >intr_io, G_IO_OUT,
encrypt_ notify, idev);
creates the notify callback. But it never triggers. On second connection the callback gets triggered, but the connect code gets run again so another refcount is added. This means the intr channel never gets closed which means it's stuck on the last event.