I wrote:
> For simplicity, I use
> the "gpio" cable driver, which accesses GPIOs through
> /sys/class/gpio/...

One issue with this approach is that allocation of GPIOs
can outlive the process making the allocation. UrJTAG
cleans up when exiting normally but doesn't when killed
by a signal.

This doesn't trouble later runs of UrJTAG or any of the
other user-space utilities that use the 8:10 interface,
but if trying to load a kernel driver after UrJTAG has
quit messily, the driver will fail to allocate its GPIOs.
E.g.,

# echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/bind
ash: write error: No such device

dmesg reveals what happened:

jz4740-mmc jz4740-mmc.0: Failed to request mmc pins: -16
jz4740-mmc: probe of jz4740-mmc.0 failed with error -16

To clean up after UrJTAG, run

# ls -1 /sys/class/gpio/ | sed -n s/gpio1/1/p |
  while read n; do echo $n >/sys/class/gpio/unexport; done

or, more specific

for n in 105 107 108 109; do echo $n >/sys/class/gpio/unexport; done

By the way, the numbers are calculated from the port base
plus the pin number. For example, UBB-JTAG-M1 puts TMS on
DAT2. DAT2 is pin 12 of port D. The base of the port is
4*32 = 96 and the GPIO number is thus 96+12 = 108.

- Werner

_______________________________________________
Qi Hardware Discussion List
Mail to list (members only): [email protected]
Subscribe or Unsubscribe: 
http://lists.en.qi-hardware.com/mailman/listinfo/discussion

Reply via email to