Instantly share code, notes, and snippets.

Embed
What would you like to do?
Along with udevedu, reload gpg scdaemon on yubikey insert
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
from __future__ import print_function, division, unicode_literals
from udevedu.utils import invoke
def init():
print("Monitor Yubikey NEO")
def check(action, device):
# print(action, device.items())
return (
device.get('ID_VENDOR_ID') == '1050' and
device.get('ID_MODEL_ID') == '0111' and
device.get('DEVNAME', '').startswith('/dev/input/event')
)
cmd = 'gpgconf --reload scdaemon'.split()
def react(action, device):
print("reload gpg scdaemon")
invoke(*cmd)
# print(action, device.items(), device)
# vim: ts=4 sw=4 sts=4 expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment