Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-13-2019, 12:25 PM   #1
Registered: May 2018
Posts: 133

Rep: Reputation: Disabled
How to access a value set during Linux startup from the user space.

I have an embedded device that is run by the Linux kernel:, it runs a GUI application which has been placed @ /etc/init.d.

Inside the kernel startup code a GPIO pin's value is being logged:

int value = 0;
    mxc_request_iomux(MX51_PIN_EIM_A24, IOMUX_CONFIG_ALT1);
    mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT1);
    mxc_iomux_set_pad(MX51_PIN_EIM_A24, PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL | PAD_CTL_100K_PU);
    mxc_iomux_set_pad(MX51_PIN_EIM_A26, PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL | PAD_CTL_100K_PU);
    gpio_request(IOMUX_TO_GPIO(MX51_PIN_EIM_A24), "gpio2_18");
    gpio_request(IOMUX_TO_GPIO(MX51_PIN_EIM_A26), "gpio2_20");

    value |= gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A24)) ? 0 : 1;
    value |= gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A26)) ? 0 : 2;
    hardwareID = value;

    printk(KERN_INFO "Hardware ID: %d\n", hardwareID); 
    return value;
Is there any way that I can access the hardwareID variable from within my code? I thought, one way would be to import the GPIO and read its value, similar to this:

const char *const amplifierGPIO = "/sys/class/gpio/gpio107/value";
but I dont need to be able to toggle the GPIO pin so I do not believe this is the right way to go about it. I thought maybe I should use put_user() or copy_to_user() but I am not sure.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
tcp keepalive - why new connections have value slightly greater than value I just set. myjess Linux - Networking 2 02-24-2017 06:16 AM
strange value assignments variable = value, value?? ostrow30 Programming 2 07-24-2011 07:59 AM
difference between value *value and value * value PoleStar Linux - Newbie 1 11-26-2010 03:37 PM
Division of Logical Memory Space in to User Space and Kernel Space shreshtha Linux - Newbie 2 01-14-2010 09:59 AM
set mysql default value to value of other field kpachopoulos Programming 1 10-11-2007 09:04 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration