Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18146

Re: how to activate uart2

$
0
0

ok,

i ve tried with a litte success but i am not finished.

this ist the cpp source code

 

  system("/bin/cp -f /etc/inittab /etc/inittab.restore");

  snprintf(cmd, sizeof(cmd),

   "/bin/sed -i -e '/^\\(S.*getty.*%s$\\)/i\\\n"

   "# Disabling getty to allow Arduino sketch to use %s and\n"

   "# adding sysinit commands to restore normal behaviour on next boot\n"

   "' /etc/inittab",

  ttydev, ttydev);

  system(cmd);

  snprintf(cmd, sizeof(cmd),

   "/bin/sed -i -e '/^\\(S.*getty.*%s$\\)/i\\\n"

   "res1:2345:sysinit:/bin/mv -f /etc/inittab.restore /etc/inittab\n"

   "' /etc/inittab",

  ttydev);

  system(cmd);

  snprintf(cmd, sizeof(cmd),

   "/bin/sed -i -e '/^\\(S.*getty.*%s$\\)/i\\\n"

   "res2:2345:sysinit:/sbin/telinit q\n"

   "' /etc/inittab",

  ttydev);

  system(cmd);

 

// Modify inittab to stop use of this console device for user log-in

  snprintf(cmd, sizeof(cmd),

   "/bin/sed -i -e 's/^\\(S.*getty.*%s$\\)/#\\1/' /etc/inittab",

  ttydev);

  system(cmd);

 

// Tell init to reload its configuration

  system("/sbin/telinit q");

 

// Forcibly kill any processes still using the tty device.

  snprintf(cmd, sizeof(cmd),

   "export PATH=/bin:/usr/bin; "

   "lsof | grep '%s' | cut -f 1 | sort -u | xargs -r kill -9",

  ttydev);

  system(cmd);

 

i search for getty in /etc/inttab and found

 

1:2345:respawn:/sbin/getty 38400 tty1

2:23:respawn:/sbin/getty 38400 tty2

3:23:respawn:/sbin/getty 38400 tty3

4:23:respawn:/sbin/getty 38400 tty4

5:23:respawn:/sbin/getty 38400 tty5

6:23:respawn:/sbin/getty 38400 tty6

 

# Example how to put a getty on a serial line (for a terminal)

#

#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100

#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

T0:23:respawn:/sbin/getty -L ttyMFD2 115200 vt100

i uncommented the last line and reload with

     telinit q

 

after this i started my programm

and tried to read the serial rfid reader

 

and... the resources was not busy, but  i dont get the data i want, i only get

 

b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

but i expect hex values, does someone has an idea?

 

regardes stefan


Viewing all articles
Browse latest Browse all 18146

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>