Skip to content

Instantly share code, notes, and snippets.

@leopku
Forked from bigeagle/scdaemon_reload.py
Created November 2, 2016 05:21
Show Gist options
  • Save leopku/7494a627bb61da3f23790b449af1e674 to your computer and use it in GitHub Desktop.
Save leopku/7494a627bb61da3f23790b449af1e674 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