Skip to content

Instantly share code, notes, and snippets.

@bigeagle
Created February 8, 2016 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bigeagle/924814b4ffd0733db2ca to your computer and use it in GitHub Desktop.
Save bigeagle/924814b4ffd0733db2ca to your computer and use it in GitHub Desktop.
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