def unexport(gpio_pin):
  """ Returns a pin to the kernel with sysfs /sys/class/gpio interface.
      Returns True if pin was unexported, False if it was already under 
      kernel control. """
  if ("USR" in gpio_pin):
    # The user LEDs are always under userspace control
    return False
  gpio_num = GPIO[gpio_pin]['gpio_num']
  gpio_file = '%s/gpio%i' % (GPIO_FILE_BASE, gpio_num)
  if (not os.path.exists(gpio_file)): 
    # Pin not under userspace control
    return False
  with open(UNEXPORT_FILE, 'wb') as f:
    f.write(str(gpio_num))
  return True
dataset/ETHPy150Open graycatlabs/PyBBIO/bbio/platform/beaglebone/pinmux.py/unexport/original