Find the answer to your Linux question:
Results 1 to 4 of 4
I have an custom embedded debian running on kernel 2.6.31. I need to insert a driver compiled as module as early as possible in the bootprocedure to start a measurement. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2012
    Posts
    9

    Permissions to make entry in /dev/tty


    I have an custom embedded debian running on kernel 2.6.31. I need to insert a driver compiled as module as early as possible in the bootprocedure to start a measurement. so i wrote a c program to load the driver and make some configurations with
    Code:
    ioctl()
    to the device in /dev/tty. The problem is that the device is not created at all when i add the program to be started before beeing logged in (eg in rc.local). if i run my c-program after login manually, everything is working well. is that a question of permissions? or can i make entrys to /dev only after a certain point of init? the fun thing is, that if i add a shell script doing
    Code:
    mknod /dev/ttySC0 c 205 209
    to rc.local at the same place, the device is perfectly created...
    thanks for any help, nimdardo

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by nimdardo View Post
    The problem is that the device is not created at all when i add the program to be started before beeing logged in (eg in rc.local). if i run my c-program after login manually, everything is working well. is that a question of permissions? or can i make entrys to /dev only after a certain point of init? the fun thing is, that if i add a shell script doing
    Code:
    mknod /dev/ttySC0 c 205 209
    to rc.local at the same place, the device is perfectly created...
    what exactly are you putting in rc.local and why is putting mknod command in rc.local (if it makes it work) not sufficient?

    anyway, i would recommend redirecting the STDERR/STDOUT of all your custom rc.local commands to a log file to see if there is any useful output to look at, during the boot sequence.

  3. #3
    Just Joined!
    Join Date
    Aug 2012
    Posts
    9
    To explain a bit - I have an custom embedded system with 5 expander slots for different modules. they are recognized during the bootup process and the drivers are loaded with the appropriate settings. in this case its for RS232 expander modules. because there are 5 different IRQ-lines, and chip selects, the driver has to be loaded and later configurated with the correct settings from userspace. in my rc.local, i have the following entry:
    Code:
    # HW Handler
    echo -n "Autoconfigurator Modules..."
    /home/autoconfigurator &> /var/bootlog
    echo "done."
    thats why i have to make the following steps:
    • read eeproms on modules to check moduletype on slot 1-5
    • insert the serial driver
    • change sysfs for correct SPI-configuration
    • change parameters for irq ports via ioctl()


    and thats why i can't use the mknod variant - if i dont create the device with the driver, i cannot access via ioctl().

    For the part with Logfile - I have to adapt the device driver first to make it more verbose, i will post a log soon.
    thanks for your help already, simon

    edit: i just discovered that when i manually start the program after login the first time the device is not created. but if i rmmod and insmod the driver again, it works well. so the problem might be in my program anyways. i will check that first...
    Last edited by nimdardo; 08-21-2012 at 10:26 AM.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Aug 2012
    Posts
    9
    sorry, problem solved - i did the whole stuff in the wrong order. I did:

    • insert driver
    • change sysfs
    • changes with ioctl()


    but correct is:

    • change sysfs
    • insert driver
    • changes with ioctl()


    now my device is perfectly created - AND configured in rc.local.

    thanks atreyu anyway

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •