[PLUG] help me understand this pin-level kernel-interface stuff

Wayne E. Van Loon Sr. wevl at pacifier.com
Fri Sep 19 18:57:03 UTC 2008


Russell:
Sounds like a rough way to go. Does the board have a parallel printer port?
Wayne
Russell Senior wrote:
> This is way more low-level than I normally deal with from a
> programming perspective (though, yes, i can solder big things).
>
> In what is perhaps a recap of an earlier problem I asked about here,
> oh, a year or so ago (last November-ish), I would like to be able to
> poll the state of an external mechanical switch (off/on) from Linux
> userspace.  That is, I want to be able the read /proc/<mumble>/switch1
> and get a "1" when the switch is closed or a "0" when the switch is
> open.  Or something like that.
>
> The board I am dealing with is the Alix 3D3 [1].  I inquired to PC
> Engines (the designer/vendor) about what I am trying to do, and they
> pointed me at a pad on the PCB labelled "S1" which was unpopulated,
> but intended for a "switch", probably like a reset switch of some
> kind.
>
> Sounds like it could be perfect.  Except for:
>
>  a) I have only the barest whiff of an idea how to get the switch
>     state information from Linux user-space; and
>
>  b) I don't know what kind of switch I should be attaching, if there
>     are conventions about what else (e.g. capacitor or resistors or
>     whatever) to include in the switch circuit and whether or not
>     those are already on the PCB.
>
> As for exception (a), I looked at the schematic in reference [1] and
> traced the S1 pad on the board to something called <MODESW#>, which
> appears to be attached to ball C9 on the CPU.  If I consult the AMD
> Geode LX Processors Data Book [2], I find that ball C9 appears to be
> labelled DQ29 on the Memory Data Bus.  Beyond that, my understanding
> begins to degrade rather rapidly and catastrophically.  Not to be
> completely thwarted, I note that there are also three LEDs that are
> have an LED driver in OpenWrt's Linux kernel, so I look there [3].
> Clearly, the LED state (which are also connected to DQ pins 16,
> 28, and 19, respectively) is writable somehow using port I/O.
>
> I would have some chance of writing a driver to poll the state of my
> switch, under the following conditions:
>
>  A) I could locate an example of some other driver polling a similar
>     state; and 
>
>  B) I had the foggiest idea how to translate the information in [2]
>     into a port number and bit offset from which to read.
>
> Could any helpful souls out there (and yes, I am talking to you Galen,
> amongst others) either solve my problem in its entirety, or barring
> that, gently shove me in the direction of a solution?
>
> Thanks!
>
>
> References:
>
> [1] http://www.pcengines.ch/schema/alix3d.pdf
> [2] http://www.amd.com/files/connectivitysolutions/geode/geode_lx/33234d_lx_ds.pdf
> [3] https://dev.openwrt.org/browser/trunk/target/linux/generic-2.6/files/drivers/leds/leds-alix.c
>
>   




More information about the PLUG mailing list