<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>P {MARGIN-TOP: 0mm; MARGIN-BOTTOM: 0mm}</style>
</head>
<body>
<div style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" id="ezFormProc_div">
<div style="FONT-FAMILY: Arial" id="msgbody">
<div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">
<div>Hi, lovely linux people,</div>
<div><br>
I just found that the printk called from insde the kernel and the printf from the busybox is ultimately using the same routine.</div>
<div>(When we use printf from busybox, it eventually calls the system call sys_write which eventually calls some time of bit
</div>
<div>blitting functions. </div>
<div>The printk in the kernel also uses the same bit blitting functions. bit blitting functions writes pixel data line by line to draw
</div>
<div>the characters on the LCD)</div>
<div>&nbsp;</div>
<div>For example, to hide the cursor, which happens both in printk and printf cases when a new data is written,
</div>
<div>in printk case : the hid_cursor(vc) is called from inside&nbsp; vt_console_print function.</div>
<div>in printf case : the hid_cursor(vc) is called from inside do_con_write function.</div>
<div>* vc is of type struct vc_data *. </div>
<div>&nbsp;</div>
<div>Since the hid_cursor function is the same, it follows the same path after that.&nbsp; To name the main functions in this case ..
</div>
<div>From the hid_cursor, vc-&gt;vc_sw-&gt;con_cursor(vc, CM_ERASE)&nbsp;&nbsp;is called&nbsp;which is fbcon_cursor function.
</div>
<div>Then fbcon_cursor calls ops-&gt;cursor(vc, info, mode, y, get_color(vc, info, c, 1), get_color(vc, info, c, 0)) &nbsp;which is bit_cursor.
</div>
<div>Then bit_cursor calls soft_cursor(info, &amp;cursor).</div>
<div>Then soft_cursor calls info-&gt;fbops-&gt;fb_imageblit(info, image) which is cfb_bitblit function.</div>
<div>Then cfb_bitblit calls fast_imageblit(image, p, dst1, fgcolor, bgcolor). </div>
<div>Then finally fast_imageblit repeatedly calls FB_WRITEL((end_mask &amp; eorx)^bgx, dst&#43;&#43;) which is actually writing
</div>
<div>the pixcel data (combined pixels in 32 bits) to the framebuffer memory.</div>
<div>&nbsp;</div>
<div>My problem is : the same function path works for printk (texts are written on the LCD ok), but the same function path
</div>
<div>doesn't work for the printf case.</div>
<div>It just stops at the first pixel data write (FB_WRITE) in printf case. I guess the ack is not coming from that memory.</div>
<div>I've printed the address of the frame buffer and it looked not much different (0x69xxxxxx). I'll check if the address range
</div>
<div>is really in the frame buffer range allocated before (during the framebuffer probe initialization). I'll also look into the MMU
</div>
<div>page table setup.. But I thought there maybe someone who has had the same experience like the one I have now.</div>
<div>&nbsp;</div>
<div>Has anybody have similar situation before? (printk prints ok but printf doesn't print to the LCD using frame buffer)</div>
<div>Any hint would be appreciated.</div>
<div>Thank you!</div>
<div>Chan</div>
<div>&nbsp;</div>
<hr tabindex="-1">
<b>From : </b>&quot;Chan Kim&quot; &lt;ckim@etri.re.kr&gt;<br>
<b>Sent : </b>2014-03-17 09:14:08 ( &#43;09:00 )<br>
<b>To : </b>kernelnewbies@kernelnewbies.org &lt;kernelnewbies@kernelnewbies.org&gt;<br>
<b>Cc : </b><br>
<b>Subject : </b>RE: Please help.. trying to use USB keyboard to open a shell on LCD display<br>
<br>
<style>P {
        MARGIN-TOP: 0mm; MARGIN-BOTTOM: 0mm
}
</style>
<div style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" id="ezFormProc_div">
<div style="FONT-FAMILY: Arial" id="msgbody">
<div>
<div style="LINE-HEIGHT: 15pt"><br>
There is no reponse yet to this question.. any help/hint would be appreciated.</div>
<div style="LINE-HEIGHT: 15pt">I found that I may have to use getty in the /etc/inittab file to get tty for a vc.</div>
<div style="LINE-HEIGHT: 15pt">For busybox, the example in init/init.c suggests entries like</div>
<div style="LINE-HEIGHT: 15pt">tty4::respawn:/sbin/getty 38400 tty4</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">I earlier found the keyboard seems to be connected to tty1 and the printk output is switched to tty1 towards the end during the initialization. So I tried in the inittab</div>
<div style="LINE-HEIGHT: 15pt">
<div style="LINE-HEIGHT: 15pt">tty1::respawn:/sbin/getty 38400 tty1</div>
<div style="LINE-HEIGHT: 15pt">and</div>
<div style="LINE-HEIGHT: 15pt">
<div style="LINE-HEIGHT: 15pt">1::respawn:/sbin/getty 38400 tty1</div>
<div style="LINE-HEIGHT: 15pt">But didn't work.</div>
</div>
</div>
<div style="LINE-HEIGHT: 15pt">I know how to start a shell on tty1 (using inittab). But How do I map tty1 to the vc and to the LCD using boot argument or busybox setting? This seems to be the key question.
<br>
Thansk,</div>
<div style="LINE-HEIGHT: 15pt">Chan</div>
<div style="LINE-HEIGHT: 15pt">&nbsp;</div>
<div style="LINE-HEIGHT: 15pt">
<hr tabindex="-1">
</div>
<div style="LINE-HEIGHT: 15pt"><b>From : </b>&quot;Kim Chan&quot; &lt;ckim@etri.re.kr&gt;<br>
<b>Sent : </b>2014-03-12 15:31:17 ( &#43;09:00 )<br>
<b>To : </b>kernelnewbies@kernelnewbies.org &lt;kernelnewbies@kernelnewbies.org&gt;<br>
<b>Cc : </b><br>
<b>Subject : </b>Please help.. trying to use USB keyboard to open a shell on LCD display<br>
<br>
</div>
<style>P {
        MARGIN-TOP: 0mm; MARGIN-BOTTOM: 0mm
}
</style>
<div style="LINE-HEIGHT: 15pt; FONT-FAMILY: Arial; FONT-SIZE: 10pt" id="ezFormProc_div">
<div style="FONT-FAMILY: Arial" id="msgbody">
<div>
<div style="LINE-HEIGHT: 15pt">
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US"><font face="Courier New">Hello, folks,</font></span></font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US"><span lang="EN-US"><font face="Courier New"><span lang="EN-US"></span></font></span></span></font></span>&nbsp;</p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US">It is a comfort to me that I have people to ask questions here and I hope I could&nbsp;be answering to some hard quetions someday.</span></font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US"></span></font></span><span lang="EN-US"><font face="Courier New"><span lang="EN-US">I've beeing trying to attach&nbsp;a USB keyboard to our embedded
 system to open a shell on the LCD display using framebuffer console. The USB host controller is from the opencore(USB1.1) and it works for USB memory.</span></font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US">Some of the boot arguments are (I've tried some variants)</span></font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US">&quot;console=tty1 &quot;<br>
&quot;fbcon=map:0000,font:SUN8x16,vc:1-3 &quot;<br>
&quot;root=/dev/ram &quot;</span></font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US"></span></font></span>&nbsp;</p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">The problem is, after the final sys_execve() which executes /sbin/init of the ramdisk, I cannot see any printf results frome the busybox init_main function not to
 mention the shell. So I cannot use shell commands like getty. Using uart as the console I can see printf results in the busybox init_main routine. (I use &quot;console=ttyS,mmio,0xff003000,115200n8&nbsp;&quot; in that case)</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">Using some prints on separate uart print routine, I can see from the kbd_event function that the key value is going to current vc which is using tty1. The key value
 is then handed to put_queue function where the character is somehow copied to tty buffer. Flush_to_ldisc is scheduled for it and it will probably get passed on to the virtual console. By the way, I guess the keyboard data is delivered to current fg_console
 (vc 0 which is using tty1).</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"></font></span>&nbsp;</p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">Added to this, there is a notifier_call_chain and the notifier block is registered by vcs_poll_data_get function which I don't know weather is necessary or not.
 So one of my questions is<span style="mso-spacerun: yes"> </span>if vcs is necessary for my case. (I guess not. There is no other notifier blocks registered)
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
 <o:p></o:p></font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText">&nbsp;</p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">I gathered that without inittab (I don't use inittab which should be ok for most cases) the assumed default inittab tty2::askfirst:-/bin/sh tty3::askfirst:-/bin/sh
 tty4::askfirst:-/bin/sh is being applied by the busybox so there maybe 3 shells on tty2,tty3, and tty4 running somewhere.</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">But even if there are shells running I don't know how to switch to those ttys.
</font></span><span lang="EN-US"><font face="Courier New">I tried using Ctrl-Alt F2 (or F3, F4) using the USB keyboard to switch to tty2,3,4 to see if any shell comes up on the LCD but couldn't see it.</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">I tried using inittab with no avail before.</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText">&nbsp;</p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><font face="Courier New">And I don't know how the printf in busybox is connected to the kernel.&nbsp; I guess busybox talks with stdio(stdout,stdin..) and the file is connected to the kernel anyhow. I've digged
 up how vc driver is connected to the console switch functions and to the bit blitting functions and how the printk is handled in the kernel. But</font>
<span lang="EN-US"><font face="Courier New">these console, tty, framebuffer console.. things are very complex to me. and I hope somebody could point me to what should be checked. Any hint will be deeply appreciated.</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New"><span lang="EN-US"><font face="Courier New"></font></span></font></span>&nbsp;</p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">Best Regards,</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoPlainText"><span lang="EN-US"><font face="Courier New">Chan</font></span></p>
<p style="LINE-HEIGHT: 15pt; MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt" lang="EN-US">_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank"><font color="#0000ff">Kernelnewbies@kernelnewbies.org</font></a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>