Question: half-duplex and full-duplex serial driver

2007-03-26 Thread Mockern
Hi,

Could you help me please, how can my serial driver to work in  half-duplex and 
full-duplex mode?

Thank you
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: half-duplex and full-duplex serial driver

2007-03-26 Thread Mockern
Hi,

Could you help me please, how can my serial driver to work in  half-duplex and 
full-duplex mode?

Thank you
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


problem: init_termios = tty_std_termios;

2007-03-25 Thread Mockern
Hi,

I just added 

"mydriver_tty_driver->init_termios = tty_std_termios"

to my init driver function.

Problem: But now I can't see data at user level application. It looks like 
flip_buffer needs to get termination character(or new line character) to push 
data to high level.

Which character should I add to flip_buffer to push data to high level? I tried 
to add '/n', it works, but after that user level gets '/n' as well. But I need 
something like a filter, to inform flip_buffer only, not user level application.

Thank you   
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


problem: init_termios = tty_std_termios;

2007-03-25 Thread Mockern
Hi,

I just added 

mydriver_tty_driver-init_termios = tty_std_termios

to my init driver function.

Problem: But now I can't see data at user level application. It looks like 
flip_buffer needs to get termination character(or new line character) to push 
data to high level.

Which character should I add to flip_buffer to push data to high level? I tried 
to add '/n', it works, but after that user level gets '/n' as well. But I need 
something like a filter, to inform flip_buffer only, not user level application.

Thank you   
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: Where tty layer keeps termios data?

2007-03-23 Thread Mockern
Hi,

Could someone please to help with next question:

Where Linux (or maybe tty layer) keeps termios data?

If I run stty command, where stty gets current termios settings?

Thank you
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: Where tty layer keeps termios data?

2007-03-23 Thread Mockern
Hi,

Could someone please to help with next question:

Where Linux (or maybe tty layer) keeps termios data?

If I run stty command, where stty gets current termios settings?

Thank you
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Problem: cat < /dev/my_ttyS0 is not blocked

2007-03-10 Thread Mockern
Hi,

I have a problem with  cat < /dev/my_ttyS0 (see strace output below). cat 
function is not blocked. I don't understand why it is not stopped at read(0, __ 
 and terminated?
Thank you

-- 
execve("/bin/cat", ["cat"], [/* 12 vars */]) = 0
brk(0)  = 0x7d000
open("/etc/ld.so.preload", O_RDONLY)= -1 ENOENT (No such file or 
directory)
open("/etc/ld.so.cache", O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=5664, ...}) = 0
old_mmap(NULL, 5664, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3)= 0
open("/lib/libm.so.6", O_RDONLY)= 3
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250B\0\000"..., 512) = 
512
fstat64(3, {st_mode=S_IFREG|0755, st_size=480324, ...}) = 0
old_mmap(NULL, 506412, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002
mprotect(0x40093000, 35372, PROT_NONE)  = 0
old_mmap(0x40098000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
0x7) = 0x40098000
close(3)= 0
open("/lib/libcrypt.so.1", O_RDONLY)= 3
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260\10\0"..., 512) = 
512
fstat64(3, {st_mode=S_IFREG|0755, st_size=19940, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x40019000
old_mmap(NULL, 211220, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4009c000
mprotect(0x400a1000, 190740, PROT_NONE) = 0
old_mmap(0x400a4000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) 
= 0x400a4000
old_mmap(0x400a9000, 157972, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_ANONYMOUS, -1, 0) = 0x400a9000
close(3)= 0
open("/lib/libc.so.6", O_RDONLY)= 3
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\330p\1\000"..., 512) = 
512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1240024, ...}) = 0
old_mmap(NULL, 1257088, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400d
mprotect(0x401f5000, 56960, PROT_NONE)  = 0
old_mmap(0x401f8000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
0x12) = 0x401f8000
old_mmap(0x40201000, 7808, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_ANONYMOUS, -1, 0) = 0x40201000
close(3)= 0
munmap(0x40017000, 5664)= 0
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
read(0, "", 8192)   = 0
io_submit(0, 0x40200164, 0 
Process 1653 detached
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Problem: cat /dev/my_ttyS0 is not blocked

2007-03-10 Thread Mockern
Hi,

I have a problem with  cat  /dev/my_ttyS0 (see strace output below). cat 
function is not blocked. I don't understand why it is not stopped at read(0, __ 
 and terminated?
Thank you

-- 
execve(/bin/cat, [cat], [/* 12 vars */]) = 0
brk(0)  = 0x7d000
open(/etc/ld.so.preload, O_RDONLY)= -1 ENOENT (No such file or 
directory)
open(/etc/ld.so.cache, O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=5664, ...}) = 0
old_mmap(NULL, 5664, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3)= 0
open(/lib/libm.so.6, O_RDONLY)= 3
read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250B\0\000..., 512) = 
512
fstat64(3, {st_mode=S_IFREG|0755, st_size=480324, ...}) = 0
old_mmap(NULL, 506412, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002
mprotect(0x40093000, 35372, PROT_NONE)  = 0
old_mmap(0x40098000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
0x7) = 0x40098000
close(3)= 0
open(/lib/libcrypt.so.1, O_RDONLY)= 3
read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260\10\0..., 512) = 
512
fstat64(3, {st_mode=S_IFREG|0755, st_size=19940, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x40019000
old_mmap(NULL, 211220, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4009c000
mprotect(0x400a1000, 190740, PROT_NONE) = 0
old_mmap(0x400a4000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) 
= 0x400a4000
old_mmap(0x400a9000, 157972, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_ANONYMOUS, -1, 0) = 0x400a9000
close(3)= 0
open(/lib/libc.so.6, O_RDONLY)= 3
read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\330p\1\000..., 512) = 
512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1240024, ...}) = 0
old_mmap(NULL, 1257088, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400d
mprotect(0x401f5000, 56960, PROT_NONE)  = 0
old_mmap(0x401f8000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
0x12) = 0x401f8000
old_mmap(0x40201000, 7808, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_ANONYMOUS, -1, 0) = 0x40201000
close(3)= 0
munmap(0x40017000, 5664)= 0
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
read(0, , 8192)   = 0
io_submit(0, 0x40200164, 0 unfinished ... exit status 0
Process 1653 detached
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


block_til_ready

2007-03-08 Thread Mockern
Hi,

What is the simpliest implementation of block_til_ready for tty driver?

Thanks,

Andy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


block_til_ready

2007-03-08 Thread Mockern
Hi,

What is the simpliest implementation of block_til_ready for tty driver?

Thanks,

Andy
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: schedule()

2007-03-06 Thread Mockern
Hi,

What does schedule() function do? I want to make my kthread preemptive.

Thanks
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: schedule()

2007-03-06 Thread Mockern
Hi,

What does schedule() function do? I want to make my kthread preemptive.

Thanks
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Problem: how to make kernel thread more faster?

2007-03-05 Thread Mockern
hi,

Is there a way how to make kernel thread more faster?

I put some of my code to the kthread, but I noticed that kthread sends data 
more slow
than original driver without kthread.

Thank you

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


timeout = 1 millisecond for wait_event_timeout

2007-03-05 Thread Mockern
Hi,

I have a question. How can I make timeout = 1 millisecond for wait_event_timeout
function? 

Something like (HZ/1000)*x?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: Watchdog driver for the SA11x0/PXA2xx

2007-03-05 Thread Mockern
hi,

Could someone  explain me please, do I need sa1100_wdt.c in my Linux box?

What is the main goal of this driver?

Thank you 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Problem: Kernel oops

2007-03-05 Thread Mockern
Hi,

I have the Linux kernel oops problem sometime.
How can I fix it?
Thank you

-
Unable to handle kernel NULL pointer dereference at virtual address 0004
pgd = c0004000
[0004] *pgd=
Internal error: Oops: 17 [#1]
Modules linked in:
CPU: 0
PC is at serial_pxa_irq+0x14/0x510
LR is at __do_irq+0x4c/0x88
pc : []lr : []Not tainted
sp : c024fea4  ip : c024fee4  fp : c024fee0
r10: c029dc20  r9 : 69052d06  r8 : c024ff54
r7 : 000d  r6 :   r5 :   r4 : 
r3 : 4013  r2 : c024ff54  r1 :   r0 : 000d
Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  Segment kernel
Control: 397F  Table: A3B3  DAC: 0017
Process swapper (pid: 0, stack limit = 0xc024e198)
Stack: (0xc024fea4 to 0xc025)
fea0:  c02a5160 c024feec c024feb8 c00453c8 c0052a20 c3d47d00 
fec0:  000d c024ff54 69052d06 c029dc20 c024ff04 c024fee4 c00229f8
fee0: c0171a9c c029def8 000d c024ff54 c02b3048 c024ff54 c024ff20 c024ff08
ff00: c0022c34 c00229b8 c029def8 f2d0 0010 c024ff50 c024ff24 c0022cd0
ff20: c0022bd8 c024e018   f2d0 0010 c02b3048 a001e4ac
ff40: a001e44c c024ffa8 c024ff54 c00219a4 c0022c90 0001 c036e000 
ff60: 6013 c00235f4 c024e000 c02a7918 c02b3048 a001e4ac 69052d06 a001e44c
ff80: c024ffa8 c024ffac c024ff9c c0023634 c0023640 6013  c024ffc0
ffa0: c024ffac c0023690 c0023600 397d c029d7dc c024ffd0 c024ffc4 c0021024
ffc0: c0023654 c024fff4 c024ffd4 c000881c c002100c c00082e4 c029f4a8 397d
ffe0: c029f444 c0251ba0  c024fff8 a0008030 c000865c  
Backtrace:
[] (serial_pxa_irq+0x0/0x510) from [] (__do_irq+0x4c/0x88)
[] (__do_irq+0x0/0x88) from [] (do_level_IRQ+0x68/0xb8)
 r8 = C024FF54  r7 = C02B3048  r6 = C024FF54  r5 = 000D
 r4 = C029DEF8
[] (do_level_IRQ+0x0/0xb8) from [] (asm_do_IRQ+0x4c/0x118)
 r6 = 0010  r5 = F2D0  r4 = C029DEF8
[] (asm_do_IRQ+0x0/0x118) from [] (__irq_svc+0x24/0x80)
[] (default_idle+0x0/0x54) from [] (cpu_idle+0x48/0x64)
[] (cpu_idle+0x0/0x64) from [] (__init_end+0x24/0x2c)
 r5 = C029D7DC  r4 = 397D
[] (__init_end+0x0/0x2c) from [] 
(start_kernel+0x1cc/0x224)
[] (start_kernel+0x0/0x224) from [] (0xa0008030)
Code: e92ddff0 e24cb004 e24dd014 e1a04001 (e5911004)
 <0>Kernel panic - not syncing: Aiee, killing interrupt handler
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Problem: Kernel oops

2007-03-05 Thread Mockern
Hi,

I have the Linux kernel oops problem sometime.
How can I fix it?
Thank you

-
Unable to handle kernel NULL pointer dereference at virtual address 0004
pgd = c0004000
[0004] *pgd=
Internal error: Oops: 17 [#1]
Modules linked in:
CPU: 0
PC is at serial_pxa_irq+0x14/0x510
LR is at __do_irq+0x4c/0x88
pc : [c0171aa4]lr : [c00229f8]Not tainted
sp : c024fea4  ip : c024fee4  fp : c024fee0
r10: c029dc20  r9 : 69052d06  r8 : c024ff54
r7 : 000d  r6 :   r5 :   r4 : 
r3 : 4013  r2 : c024ff54  r1 :   r0 : 000d
Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  Segment kernel
Control: 397F  Table: A3B3  DAC: 0017
Process swapper (pid: 0, stack limit = 0xc024e198)
Stack: (0xc024fea4 to 0xc025)
fea0:  c02a5160 c024feec c024feb8 c00453c8 c0052a20 c3d47d00 
fec0:  000d c024ff54 69052d06 c029dc20 c024ff04 c024fee4 c00229f8
fee0: c0171a9c c029def8 000d c024ff54 c02b3048 c024ff54 c024ff20 c024ff08
ff00: c0022c34 c00229b8 c029def8 f2d0 0010 c024ff50 c024ff24 c0022cd0
ff20: c0022bd8 c024e018   f2d0 0010 c02b3048 a001e4ac
ff40: a001e44c c024ffa8 c024ff54 c00219a4 c0022c90 0001 c036e000 
ff60: 6013 c00235f4 c024e000 c02a7918 c02b3048 a001e4ac 69052d06 a001e44c
ff80: c024ffa8 c024ffac c024ff9c c0023634 c0023640 6013  c024ffc0
ffa0: c024ffac c0023690 c0023600 397d c029d7dc c024ffd0 c024ffc4 c0021024
ffc0: c0023654 c024fff4 c024ffd4 c000881c c002100c c00082e4 c029f4a8 397d
ffe0: c029f444 c0251ba0  c024fff8 a0008030 c000865c  
Backtrace:
[c0171a90] (serial_pxa_irq+0x0/0x510) from [c00229f8] (__do_irq+0x4c/0x88)
[c00229ac] (__do_irq+0x0/0x88) from [c0022c34] (do_level_IRQ+0x68/0xb8)
 r8 = C024FF54  r7 = C02B3048  r6 = C024FF54  r5 = 000D
 r4 = C029DEF8
[c0022bcc] (do_level_IRQ+0x0/0xb8) from [c0022cd0] (asm_do_IRQ+0x4c/0x118)
 r6 = 0010  r5 = F2D0  r4 = C029DEF8
[c0022c84] (asm_do_IRQ+0x0/0x118) from [c00219a4] (__irq_svc+0x24/0x80)
[c00235f4] (default_idle+0x0/0x54) from [c0023690] (cpu_idle+0x48/0x64)
[c0023648] (cpu_idle+0x0/0x64) from [c0021024] (__init_end+0x24/0x2c)
 r5 = C029D7DC  r4 = 397D
[c0021000] (__init_end+0x0/0x2c) from [c000881c] 
(start_kernel+0x1cc/0x224)
[c0008650] (start_kernel+0x0/0x224) from [a0008030] (0xa0008030)
Code: e92ddff0 e24cb004 e24dd014 e1a04001 (e5911004)
 0Kernel panic - not syncing: Aiee, killing interrupt handler
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: Watchdog driver for the SA11x0/PXA2xx

2007-03-05 Thread Mockern
hi,

Could someone  explain me please, do I need sa1100_wdt.c in my Linux box?

What is the main goal of this driver?

Thank you 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


timeout = 1 millisecond for wait_event_timeout

2007-03-05 Thread Mockern
Hi,

I have a question. How can I make timeout = 1 millisecond for wait_event_timeout
function? 

Something like (HZ/1000)*x?
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Problem: how to make kernel thread more faster?

2007-03-05 Thread Mockern
hi,

Is there a way how to make kernel thread more faster?

I put some of my code to the kthread, but I noticed that kthread sends data 
more slow
than original driver without kthread.

Thank you

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


kernel threads locking data

2007-03-04 Thread Mockern
hi,

how is better to lock data (a buffer) which is used by 2 kernel threads?

thank you
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


kernel threads locking data

2007-03-04 Thread Mockern
hi,

how is better to lock data (a buffer) which is used by 2 kernel threads?

thank you
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Question: 20 microseconds delay

2007-03-03 Thread Mockern
The problem is that I need to use wait_event_timeout function 

>Am Samstag 03 Mдrz 2007 15:20 schrieb Mockern:
>> Hi,
>>
>> I have a question.
>>
>> I need to use 20 microsecond delay in my driver.
>> What exact jiffies value I should define to get 20 microseconds?
>
>You can't do it with jiffies as they have 1 millisecond resolution at best. 
>You'd use something like usleep(20) instead.
>
>Hans
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [EMAIL PROTECTED]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Question: 20 microseconds delay

2007-03-03 Thread Mockern
The problem is that I need to use wait_event_timeout function.

>Mockern napsal(a):
>> Hi,
>> 
>> I have a question.
>> 
>> I need to use 20 microsecond delay in my driver.
>> What exact jiffies value I should define to get 20 microseconds?
>
>It's subjiffy delay unless you use 5 HZ :). Use udelay.
>
>regards,

-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: 20 microseconds delay

2007-03-03 Thread Mockern
Hi,

I have a question.

I need to use 20 microsecond delay in my driver.
What exact jiffies value I should define to get 20 microseconds?

Thank you
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Question: 20 microseconds delay

2007-03-03 Thread Mockern
Hi,

I have a question.

I need to use 20 microsecond delay in my driver.
What exact jiffies value I should define to get 20 microseconds?

Thank you
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Question: 20 microseconds delay

2007-03-03 Thread Mockern
The problem is that I need to use wait_event_timeout function.

Mockern napsal(a):
 Hi,
 
 I have a question.
 
 I need to use 20 microsecond delay in my driver.
 What exact jiffies value I should define to get 20 microseconds?

It's subjiffy delay unless you use 5 HZ :). Use udelay.

regards,

-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Question: 20 microseconds delay

2007-03-03 Thread Mockern
The problem is that I need to use wait_event_timeout function 

Am Samstag 03 Mдrz 2007 15:20 schrieb Mockern:
 Hi,

 I have a question.

 I need to use 20 microsecond delay in my driver.
 What exact jiffies value I should define to get 20 microseconds?

You can't do it with jiffies as they have 1 millisecond resolution at best. 
You'd use something like usleep(20) instead.

Hans

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


cat reading problem

2007-02-23 Thread Mockern
Hello,

I tried to cat < /dev/mytty/ttyS3, but cat shows nothing. I attached here strace
  
cat < /dev/mytty/ttyS3 and cat < hello. Hello is just a file. As you can see 
the 

result of strace cat is identical, but in tty case I can't see nothing. Why 
does cat write nothing at my console?

Thank you, 



[EMAIL PROTECTED]:/home# strace cat  < hello
│c│c│c│c│c│c│c│c│c│c│c│c..
munmap(0x40017000, 5664)= 0
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
read(0, "Hello World!", 8192)   = 12
write(1, "Hello World!", 12Hello World!)= 12
read(0, "", 8192)   = 0
io_submit(0, 0x40200164, 0 
Process 1520 detached
[EMAIL PROTECTED]:/home# strace cat  < /dev/mytty/ttyS3
│c│c│c│c│c│c│c│c│c│c│c│c│c.
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
read(0, "\376\377\377f\377\330\", 8192) = 8
write(1, "\376\377\377f\377\330\", 8│║ f0) = 8
read(0, "", 8192)   = 0
io_submit(0, 0x40200164, 0 
Process 1522 detached
[EMAIL PROTECTED]:/home#
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


cat reading problem

2007-02-23 Thread Mockern
Hello,

I tried to cat  /dev/mytty/ttyS3, but cat shows nothing. I attached here strace
  
cat  /dev/mytty/ttyS3 and cat  hello. Hello is just a file. As you can see 
the 

result of strace cat is identical, but in tty case I can't see nothing. Why 
does cat write nothing at my console?

Thank you, 



[EMAIL PROTECTED]:/home# strace cat   hello
│c│c│c│c│c│c│c│c│c│c│c│c..
munmap(0x40017000, 5664)= 0
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
read(0, Hello World!, 8192)   = 12
write(1, Hello World!, 12Hello World!)= 12
read(0, , 8192)   = 0
io_submit(0, 0x40200164, 0 unfinished ... exit status 0
Process 1520 detached
[EMAIL PROTECTED]:/home# strace cat   /dev/mytty/ttyS3
│c│c│c│c│c│c│c│c│c│c│c│c│c.
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
read(0, \376\377\377f\377\330\, 8192) = 8
write(1, \376\377\377f\377\330\, 8│║ f0) = 8
read(0, , 8192)   = 0
io_submit(0, 0x40200164, 0 unfinished ... exit status 0
Process 1522 detached
[EMAIL PROTECTED]:/home#
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cat problem in tiny_tty driver (the source included)

2007-02-21 Thread Mockern
cat < /dev/my_tty does nothing, just stopped for reading. I tried to send a 
data,
but there was no respond, just waiting.


>On Wed, Feb 21, 2007 at 10:33:52PM +0300, Mockern wrote:
>> Thank you very much for you help.
>> 
>> BTW, for cat < /dev/my_tty1 can see here something wrong?
>> as I understand tiny_timer function sends data to tty level
>> by calling tty_flip_buffer_push(tty).
>> 
>> Is this enough to support cat < /dev/my_tty1?
>
>I don't really know the tty layer very much.  I just saw a very obvious
>bug in the code.
>
>Does cat from the device give an error or does it just not do anything?
>
>What does strace say for that?
>
>--
>Len Sorensen
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [EMAIL PROTECTED]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cat problem in tiny_tty driver (the source included)

2007-02-21 Thread Mockern
Thank you very much for you help.

BTW, for cat < /dev/my_tty1 can see here something wrong?
as I understand tiny_timer function sends data to tty level
by calling tty_flip_buffer_push(tty).

Is this enough to support cat < /dev/my_tty1?


>On Wed, Feb 21, 2007 at 06:03:16PM +0300, Mockern wrote:
>> I tried to check cat operations for tiny_tty driver from LDD book. 
>> 
>> What is wrong with cat operation here?
>> 
>> Here is the output from strace cat hello > /dev/my_tty1
>> 
>> [EMAIL PROTECTED]:/home# strace cat hello > /dev/my_tty1
>> execve("/bin/cat", ["cat", "hello"], [/* 12 vars */]) = 0
>> brk(0)  = 0x7d000
>> open("/etc/ld.so.preload", O_RDONLY)= -1 ENOENT (No such file or 
>> directory)
>> open("/etc/ld.so.cache", O_RDONLY)  = 3
>> fstat64(3, {st_mode=S_IFREG|0644, st_size=5664, ...}) = 0
>> old_mmap(NULL, 5664, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
>> close(3)= 0
>> open("/lib/libm.so.6", O_RDONLY)= 3
>> read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250B\0\000"..., 512) 
>> = 51
>> 2
>> fstat64(3, {st_mode=S_IFREG|0755, st_size=480324, ...}) = 0
>> old_mmap(NULL, 506412, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002
>> mprotect(0x40093000, 35372, PROT_NONE)  = 0
>> old_mmap(0x40098000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
>> 0x70
>> 000) = 0x40098000
>> close(3)= 0
>> open("/lib/libcrypt.so.1", O_RDONLY)= 3
>> read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260\10\0"..., 512) = 
>> 512
>> fstat64(3, {st_mode=S_IFREG|0755, st_size=19940, ...}) = 0
>> old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
>> = 0
>> x40019000
>> old_mmap(NULL, 211220, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4009c000
>> mprotect(0x400a1000, 190740, PROT_NONE) = 0
>> old_mmap(0x400a4000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
>> 0) =
>>  0x400a4000
>> old_mmap(0x400a9000, 157972, PROT_READ|PROT_WRITE, 
>> MAP_PRIVATE|MAP_FIXED|MAP_ANO
>> NYMOUS, -1, 0) = 0x400a9000
>> close(3)= 0
>> open("/lib/libc.so.6", O_RDONLY)= 3
>> read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\330p\1\000"..., 512) 
>> = 51
>> 2
>> fstat64(3, {st_mode=S_IFREG|0755, st_size=1240024, ...}) = 0
>> old_mmap(NULL, 1257088, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400d
>> mprotect(0x401f5000, 56960, PROT_NONE)  = 0
>> old_mmap(0x401f8000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
>> 0x12
>> ) = 0x401f8000
>> old_mmap(0x40201000, 7808, PROT_READ|PROT_WRITE, 
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONY
>> MOUS, -1, 0) = 0x40201000
>> close(3)= 0
>> munmap(0x40017000, 5664)= 0
>> getuid32()  = 0
>> getgid32()  = 0
>> setgid32(0) = 0
>> setuid32(0) = 0
>> brk(0)  = 0x7d000
>> brk(0x9e000)= 0x9e000
>> brk(0)  = 0x9e000
>> open("hello", O_RDONLY) = 3
>> read(3, "123456789", 8192)  = 9
>> write(1, "123456789", 9)= -1 EINVAL (Invalid 
>> argument)//??
>> write(2, "cat: ", 5cat: )= 5
>> write(2, "Write Error", 11Write Error) = 11
>> write(2, ": Invalid argument\n", 19: Invalid argument
>> )= 19
>> close(3)= 0
>> io_submit(0, 0x40200164, 0 
>> Process 1432 detached
>> [EMAIL PROTECTED]:/home#
>> 
>> 
>> 
>> /*
>>  * Tiny TTY driver
>>  *
>>  * Copyright (C) 2002-2004 Greg Kroah-Hartman ([EMAIL PROTECTED])
>>  *
>>  *   This program is free software; you can redistribute it and/or modify
>>  *   it under the terms of the GNU General Public License as published by
>>  *   the Free Software Foundation, version 2 of the License.
>>  *
>>  * This driver shows how to create a minimal tty driver.  It does not rely on
>>  * any backing hardware, but creates a timer that emulates data being 
>> received
>>  * from some k

cat problem in tiny_tty driver (the source included)

2007-02-21 Thread Mockern
I tried to check cat operations for tiny_tty driver from LDD book. 

What is wrong with cat operation here?

Here is the output from strace cat hello > /dev/my_tty1

[EMAIL PROTECTED]:/home# strace cat hello > /dev/my_tty1
execve("/bin/cat", ["cat", "hello"], [/* 12 vars */]) = 0
brk(0)  = 0x7d000
open("/etc/ld.so.preload", O_RDONLY)= -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=5664, ...}) = 0
old_mmap(NULL, 5664, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3)= 0
open("/lib/libm.so.6", O_RDONLY)= 3
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250B\0\000"..., 512) = 51
2
fstat64(3, {st_mode=S_IFREG|0755, st_size=480324, ...}) = 0
old_mmap(NULL, 506412, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002
mprotect(0x40093000, 35372, PROT_NONE)  = 0
old_mmap(0x40098000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x70
000) = 0x40098000
close(3)= 0
open("/lib/libcrypt.so.1", O_RDONLY)= 3
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260\10\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=19940, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0
x40019000
old_mmap(NULL, 211220, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4009c000
mprotect(0x400a1000, 190740, PROT_NONE) = 0
old_mmap(0x400a4000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) =
 0x400a4000
old_mmap(0x400a9000, 157972, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANO
NYMOUS, -1, 0) = 0x400a9000
close(3)= 0
open("/lib/libc.so.6", O_RDONLY)= 3
read(3, "\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\330p\1\000"..., 512) = 51
2
fstat64(3, {st_mode=S_IFREG|0755, st_size=1240024, ...}) = 0
old_mmap(NULL, 1257088, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400d
mprotect(0x401f5000, 56960, PROT_NONE)  = 0
old_mmap(0x401f8000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12
) = 0x401f8000
old_mmap(0x40201000, 7808, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONY
MOUS, -1, 0) = 0x40201000
close(3)= 0
munmap(0x40017000, 5664)= 0
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
brk(0)  = 0x7d000
brk(0x9e000)= 0x9e000
brk(0)  = 0x9e000
open("hello", O_RDONLY) = 3
read(3, "123456789", 8192)  = 9
write(1, "123456789", 9)= -1 EINVAL (Invalid 
argument)//??
write(2, "cat: ", 5cat: )= 5
write(2, "Write Error", 11Write Error) = 11
write(2, ": Invalid argument\n", 19: Invalid argument
)= 19
close(3)= 0
io_submit(0, 0x40200164, 0 
Process 1432 detached
[EMAIL PROTECTED]:/home#



/*
 * Tiny TTY driver
 *
 * Copyright (C) 2002-2004 Greg Kroah-Hartman ([EMAIL PROTECTED])
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, version 2 of the License.
 *
 * This driver shows how to create a minimal tty driver.  It does not rely on
 * any backing hardware, but creates a timer that emulates data being received
 * from some kind of hardware.
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 


#define DRIVER_VERSION "v2.0"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <[EMAIL PROTECTED]>"
#define DRIVER_DESC "Tiny TTY driver"

/* Module information */
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE("GPL");

#define DELAY_TIME  HZ * 2  /* 2 seconds per character */
#define TINY_DATA_CHARACTER 't'

#define TINY_TTY_MAJOR  240 /* experimental range */
#define TINY_TTY_MINORS 4   /* only have 4 devices */

struct tiny_serial {
struct tty_struct   *tty;   /* pointer to the tty for this 
device */
int open_count; /* number of times this port 
has been opened */
struct semaphoresem;/* locks this structure */
struct timer_list   *timer;

/* for tiocmget and tiocmset functions */
int msr;/* MSR shadow */
int mcr;/* MCR shadow */

/* for ioctl fun */
struct serial_structserial;
wait_queue_head_t   wait;
struct async_icount icount;
};

static struct tiny_serial 

cat problem in tiny_tty driver (the source included)

2007-02-21 Thread Mockern
I tried to check cat operations for tiny_tty driver from LDD book. 

What is wrong with cat operation here?

Here is the output from strace cat hello  /dev/my_tty1

[EMAIL PROTECTED]:/home# strace cat hello  /dev/my_tty1
execve(/bin/cat, [cat, hello], [/* 12 vars */]) = 0
brk(0)  = 0x7d000
open(/etc/ld.so.preload, O_RDONLY)= -1 ENOENT (No such file or directory)
open(/etc/ld.so.cache, O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=5664, ...}) = 0
old_mmap(NULL, 5664, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3)= 0
open(/lib/libm.so.6, O_RDONLY)= 3
read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250B\0\000..., 512) = 51
2
fstat64(3, {st_mode=S_IFREG|0755, st_size=480324, ...}) = 0
old_mmap(NULL, 506412, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002
mprotect(0x40093000, 35372, PROT_NONE)  = 0
old_mmap(0x40098000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x70
000) = 0x40098000
close(3)= 0
open(/lib/libcrypt.so.1, O_RDONLY)= 3
read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260\10\0..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=19940, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0
x40019000
old_mmap(NULL, 211220, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4009c000
mprotect(0x400a1000, 190740, PROT_NONE) = 0
old_mmap(0x400a4000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) =
 0x400a4000
old_mmap(0x400a9000, 157972, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANO
NYMOUS, -1, 0) = 0x400a9000
close(3)= 0
open(/lib/libc.so.6, O_RDONLY)= 3
read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\330p\1\000..., 512) = 51
2
fstat64(3, {st_mode=S_IFREG|0755, st_size=1240024, ...}) = 0
old_mmap(NULL, 1257088, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400d
mprotect(0x401f5000, 56960, PROT_NONE)  = 0
old_mmap(0x401f8000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12
) = 0x401f8000
old_mmap(0x40201000, 7808, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONY
MOUS, -1, 0) = 0x40201000
close(3)= 0
munmap(0x40017000, 5664)= 0
getuid32()  = 0
getgid32()  = 0
setgid32(0) = 0
setuid32(0) = 0
brk(0)  = 0x7d000
brk(0x9e000)= 0x9e000
brk(0)  = 0x9e000
open(hello, O_RDONLY) = 3
read(3, 123456789, 8192)  = 9
write(1, 123456789, 9)= -1 EINVAL (Invalid 
argument)//??
write(2, cat: , 5cat: )= 5
write(2, Write Error, 11Write Error) = 11
write(2, : Invalid argument\n, 19: Invalid argument
)= 19
close(3)= 0
io_submit(0, 0x40200164, 0 unfinished ... exit status 0
Process 1432 detached
[EMAIL PROTECTED]:/home#



/*
 * Tiny TTY driver
 *
 * Copyright (C) 2002-2004 Greg Kroah-Hartman ([EMAIL PROTECTED])
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, version 2 of the License.
 *
 * This driver shows how to create a minimal tty driver.  It does not rely on
 * any backing hardware, but creates a timer that emulates data being received
 * from some kind of hardware.
 */

#include linux/config.h
#include linux/kernel.h
#include linux/errno.h
#include linux/init.h
#include linux/module.h
#include linux/slab.h
#include linux/wait.h
#include linux/tty.h
#include linux/tty_driver.h
#include linux/tty_flip.h
#include linux/serial.h
#include asm/uaccess.h


#define DRIVER_VERSION v2.0
#define DRIVER_AUTHOR Greg Kroah-Hartman [EMAIL PROTECTED]
#define DRIVER_DESC Tiny TTY driver

/* Module information */
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE(GPL);

#define DELAY_TIME  HZ * 2  /* 2 seconds per character */
#define TINY_DATA_CHARACTER 't'

#define TINY_TTY_MAJOR  240 /* experimental range */
#define TINY_TTY_MINORS 4   /* only have 4 devices */

struct tiny_serial {
struct tty_struct   *tty;   /* pointer to the tty for this 
device */
int open_count; /* number of times this port 
has been opened */
struct semaphoresem;/* locks this structure */
struct timer_list   *timer;

/* for tiocmget and tiocmset functions */
int msr;/* MSR shadow */
int mcr;/* MCR shadow */

/* for ioctl fun */
struct 

Re: cat problem in tiny_tty driver (the source included)

2007-02-21 Thread Mockern
Thank you very much for you help.

BTW, for cat  /dev/my_tty1 can see here something wrong?
as I understand tiny_timer function sends data to tty level
by calling tty_flip_buffer_push(tty).

Is this enough to support cat  /dev/my_tty1?


On Wed, Feb 21, 2007 at 06:03:16PM +0300, Mockern wrote:
 I tried to check cat operations for tiny_tty driver from LDD book. 
 
 What is wrong with cat operation here?
 
 Here is the output from strace cat hello  /dev/my_tty1
 
 [EMAIL PROTECTED]:/home# strace cat hello  /dev/my_tty1
 execve(/bin/cat, [cat, hello], [/* 12 vars */]) = 0
 brk(0)  = 0x7d000
 open(/etc/ld.so.preload, O_RDONLY)= -1 ENOENT (No such file or 
 directory)
 open(/etc/ld.so.cache, O_RDONLY)  = 3
 fstat64(3, {st_mode=S_IFREG|0644, st_size=5664, ...}) = 0
 old_mmap(NULL, 5664, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
 close(3)= 0
 open(/lib/libm.so.6, O_RDONLY)= 3
 read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\250B\0\000..., 512) 
 = 51
 2
 fstat64(3, {st_mode=S_IFREG|0755, st_size=480324, ...}) = 0
 old_mmap(NULL, 506412, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002
 mprotect(0x40093000, 35372, PROT_NONE)  = 0
 old_mmap(0x40098000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
 0x70
 000) = 0x40098000
 close(3)= 0
 open(/lib/libcrypt.so.1, O_RDONLY)= 3
 read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\260\10\0..., 512) = 
 512
 fstat64(3, {st_mode=S_IFREG|0755, st_size=19940, ...}) = 0
 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
 = 0
 x40019000
 old_mmap(NULL, 211220, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4009c000
 mprotect(0x400a1000, 190740, PROT_NONE) = 0
 old_mmap(0x400a4000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
 0) =
  0x400a4000
 old_mmap(0x400a9000, 157972, PROT_READ|PROT_WRITE, 
 MAP_PRIVATE|MAP_FIXED|MAP_ANO
 NYMOUS, -1, 0) = 0x400a9000
 close(3)= 0
 open(/lib/libc.so.6, O_RDONLY)= 3
 read(3, \177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\330p\1\000..., 512) 
 = 51
 2
 fstat64(3, {st_mode=S_IFREG|0755, st_size=1240024, ...}) = 0
 old_mmap(NULL, 1257088, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400d
 mprotect(0x401f5000, 56960, PROT_NONE)  = 0
 old_mmap(0x401f8000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
 0x12
 ) = 0x401f8000
 old_mmap(0x40201000, 7808, PROT_READ|PROT_WRITE, 
 MAP_PRIVATE|MAP_FIXED|MAP_ANONY
 MOUS, -1, 0) = 0x40201000
 close(3)= 0
 munmap(0x40017000, 5664)= 0
 getuid32()  = 0
 getgid32()  = 0
 setgid32(0) = 0
 setuid32(0) = 0
 brk(0)  = 0x7d000
 brk(0x9e000)= 0x9e000
 brk(0)  = 0x9e000
 open(hello, O_RDONLY) = 3
 read(3, 123456789, 8192)  = 9
 write(1, 123456789, 9)= -1 EINVAL (Invalid 
 argument)//??
 write(2, cat: , 5cat: )= 5
 write(2, Write Error, 11Write Error) = 11
 write(2, : Invalid argument\n, 19: Invalid argument
 )= 19
 close(3)= 0
 io_submit(0, 0x40200164, 0 unfinished ... exit status 0
 Process 1432 detached
 [EMAIL PROTECTED]:/home#
 
 
 
 /*
  * Tiny TTY driver
  *
  * Copyright (C) 2002-2004 Greg Kroah-Hartman ([EMAIL PROTECTED])
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
  *   the Free Software Foundation, version 2 of the License.
  *
  * This driver shows how to create a minimal tty driver.  It does not rely on
  * any backing hardware, but creates a timer that emulates data being 
 received
  * from some kind of hardware.
  */
 
 #include linux/config.h
 #include linux/kernel.h
 #include linux/errno.h
 #include linux/init.h
 #include linux/module.h
 #include linux/slab.h
 #include linux/wait.h
 #include linux/tty.h
 #include linux/tty_driver.h
 #include linux/tty_flip.h
 #include linux/serial.h
 #include asm/uaccess.h
 
 
 #define DRIVER_VERSION v2.0
 #define DRIVER_AUTHOR Greg Kroah-Hartman [EMAIL PROTECTED]
 #define DRIVER_DESC Tiny TTY driver
 
 /* Module information */
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE(GPL);
 
 #define DELAY_TIME   HZ * 2  /* 2 seconds per character */
 #define TINY_DATA_CHARACTER  't'
 
 #define TINY_TTY_MAJOR   240 /* experimental range */
 #define TINY_TTY_MINORS  4   /* only have 4 devices */
 
 struct tiny_serial {
  struct tty_struct   *tty;   /* pointer to the tty for this 
 device */
  int

Re: cat problem in tiny_tty driver (the source included)

2007-02-21 Thread Mockern
cat  /dev/my_tty does nothing, just stopped for reading. I tried to send a 
data,
but there was no respond, just waiting.


On Wed, Feb 21, 2007 at 10:33:52PM +0300, Mockern wrote:
 Thank you very much for you help.
 
 BTW, for cat  /dev/my_tty1 can see here something wrong?
 as I understand tiny_timer function sends data to tty level
 by calling tty_flip_buffer_push(tty).
 
 Is this enough to support cat  /dev/my_tty1?

I don't really know the tty layer very much.  I just saw a very obvious
bug in the code.

Does cat from the device give an error or does it just not do anything?

What does strace say for that?

--
Len Sorensen
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: how to limit flip buffer size in tty driver?

2007-02-20 Thread Mockern
Thank you Alan for your respond,

Could you help me with a problem which I have with my tty driver, please?

It does not work with Linux cat operation (but there are no problems to write, 
read with select from user space application!). 

regards,

Andy  



>On Tue, 20 Feb 2007 11:24:10 +0300 (MSK)
>"Mockern" <[EMAIL PROTECTED]> wrote:
>
>> Hello,
>> 
>> how to limit flip buffer size in tty driver?
>
>You don't.
>
>See Documentation/tty.txt and throttle/unthrottle
>
>Alan


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: how to limit flip buffer size in tty driver?

2007-02-20 Thread Mockern
Thank you Alan for your respond,

Could you help me with a problem which I have with my tty driver, please?

It does not work with Linux cat operation (but there are no problems to write, 
read with select from user space application!). 

regards,

Andy  



On Tue, 20 Feb 2007 11:24:10 +0300 (MSK)
Mockern [EMAIL PROTECTED] wrote:

 Hello,
 
 how to limit flip buffer size in tty driver?

You don't.

See Documentation/tty.txt and throttle/unthrottle

Alan


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


apm_get_power_status question

2007-02-19 Thread Mockern
Hello,

I need to send data from my driver to apm driver,
I want to use apm_get_power_status function for getting here
my battery ststus info. But I have found this function has no implementation.

thank you
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


APM driver

2007-02-19 Thread Mockern
Hello,

I need to send a battery info status from my driver to Linux APM driver.

How can I do it?

Thank you 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


APM driver

2007-02-19 Thread Mockern
Hello,

I need to send a battery info status from my driver to Linux APM driver.

How can I do it?

Thank you 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


apm_get_power_status question

2007-02-19 Thread Mockern
Hello,

I need to send data from my driver to apm driver,
I want to use apm_get_power_status function for getting here
my battery ststus info. But I have found this function has no implementation.

thank you
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ADC driver with I2C interface

2007-02-18 Thread Mockern
Thank you, I'll take a look.


>
>did you tried www.comedi.org ?
>
>Am Sunday 18 February 2007 00:18 schrieb Mockern:
>> Hello,
>>
>> Where I can grab an example of ADC driver with I2C interface?
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to [EMAIL PROTECTED]
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/


-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: serial and tty driver

2007-02-18 Thread Mockern
Thank you for you respond.

I asked this question since I have one problem with my tty driver.
It based on serial_core.c. It works well except Linux cat operation:(.
(e.g. cat < ttyS10). I thought in tty driver there is no function
for this operation and I wanted to know that maybe serial driver has it.

Could it be the reason that cat operation in tty driver does not work
(but I can write and read from user space application!)?
Or maybe I need to implement a special function in my tty driver to support 
Linux
cat operation?

Thank you again 

  

>On Sat, Feb 17, 2007 at 12:24:22PM -0600, Paul Fulghum wrote:
>> Mockern wrote:
>> >I have a question, what is really difference between serial and tty
>> >drivers?
>> >
>> >As I understand tty is high level and communicates with user space. 
>> 
>> The serial core implements many of the details of a tty
>> driver in a common place so that individual hardware drivers
>> (serial drivers) only need implement the hardware specific code.
>> 
>> This prevents duplicating tty logic in many drivers,
>> with the possibility of mistakes/inconsistency in the
>> different tty drivers.
>> 
>> The stand alone tty drivers are mostly legacy code from
>> the time before serial core that have not been ported
>> to be a serial drivers.
>
>Not necessarily; there are a number of tty drivers, such as the
>console drivers and pseudo-tty drivers that have absolutely nothing to
>do with an RS-232 port.
>
>On the other side of the argument, another factorization of the layers
>that might have made sense was to move the functionality to the
>high-level tty layer (or in the case of hangup code, all the way up to
>the VFS layer as a generic sys_revoke functionality), but the reason
>why it didn't is largely historical.
>
>   - Ted
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [EMAIL PROTECTED]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: serial and tty driver

2007-02-18 Thread Mockern
Thank you for you respond.

I asked this question since I have one problem with my tty driver.
It based on serial_core.c. It works well except Linux cat operation:(.
(e.g. cat  ttyS10). I thought in tty driver there is no function
for this operation and I wanted to know that maybe serial driver has it.

Could it be the reason that cat operation in tty driver does not work
(but I can write and read from user space application!)?
Or maybe I need to implement a special function in my tty driver to support 
Linux
cat operation?

Thank you again 

  

On Sat, Feb 17, 2007 at 12:24:22PM -0600, Paul Fulghum wrote:
 Mockern wrote:
 I have a question, what is really difference between serial and tty
 drivers?
 
 As I understand tty is high level and communicates with user space. 
 
 The serial core implements many of the details of a tty
 driver in a common place so that individual hardware drivers
 (serial drivers) only need implement the hardware specific code.
 
 This prevents duplicating tty logic in many drivers,
 with the possibility of mistakes/inconsistency in the
 different tty drivers.
 
 The stand alone tty drivers are mostly legacy code from
 the time before serial core that have not been ported
 to be a serial drivers.

Not necessarily; there are a number of tty drivers, such as the
console drivers and pseudo-tty drivers that have absolutely nothing to
do with an RS-232 port.

On the other side of the argument, another factorization of the layers
that might have made sense was to move the functionality to the
high-level tty layer (or in the case of hangup code, all the way up to
the VFS layer as a generic sys_revoke functionality), but the reason
why it didn't is largely historical.

   - Ted
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ADC driver with I2C interface

2007-02-18 Thread Mockern
Thank you, I'll take a look.



did you tried www.comedi.org ?

Am Sunday 18 February 2007 00:18 schrieb Mockern:
 Hello,

 Where I can grab an example of ADC driver with I2C interface?
 -
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/


-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


ADC driver with I2C interface

2007-02-17 Thread Mockern

Hello,

Where I can grab an example of ADC driver with I2C interface?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Analog-to-Digital Converter (ADC) driver

2007-02-17 Thread Mockern
AD7994 4 Channel, 12-Bit ADC with I2C Compatible Interface in 16-Lead
TSSOP, 

I think it could be I2C driver 


>On 2/17/07, Mockern <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> Where I can find any ADC driver example?
>>
>
>Depending on what kind of ADC and what you want to do with it,
>anything from a simple char device to an ALSA driver could be
>appropriate.  Can you provide more information?
>
>Lee
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [EMAIL PROTECTED]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Analog-to-Digital Converter (ADC) driver

2007-02-17 Thread Mockern
AD7994 4 Channel, 12-Bit ADC with I2C Compatible Interface in 16-Lead TSSOP, 


I think it could be I2C driver 

>>On 2/17/07, Mockern <[EMAIL PROTECTED]> wrote:
>>> Hello,
>>>
>>> Where I can find any ADC driver example?
>>>
>>
>>Depending on what kind of ADC and what you want to do with it,
>>anything from a simple char device to an ALSA driver could be
>>appropriate.  Can you provide more information?
>>
>>Lee
>>-
>>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>the body of a message to [EMAIL PROTECTED]
>>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>Please read the FAQ at  http://www.tux.org/lkml/
>


-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: buffer overflows in the tty flip buffer in 2.6.17

2007-02-17 Thread Mockern
Thanx for your respond. 

Could you please inform me what patches exactly you have grabbed?

>On Sat, Feb 17, 2007 at 03:29:31PM +0300, Mockern wrote:
>> When data is received from the hardware, it needs to be placed into the tty 
>> device's flip buffer. This can be done with the following bit of code:
>> 
>> for (i = 0; i < data_size; ++i) {
>> if (tty->flip.count >= TTY_FLIPBUF_SIZE)
>> tty_flip_buffer_push(tty);
>> tty_insert_flip_char(tty, data[i], 0);
>> }
>> tty_flip_buffer_push(tty);
>> 
>> This example makes sure there are no buffer overflows in the tty flip buffer 
>> as the data is being added. 
>> 
>> But how it is done in 2.6.17 linux kernel? I did check this "overflow code" 
>> in new tty driver's code. This code looks like just removed. But somehow 
>> overflow in the tty buffer must be kept.
>
>Well there was a problem in 2.6.16, which was fixed by 2.6.18, although
>I am not sure if it was done by 2.6.17.  It would loose characters due
>to buffer overflow and not properly checking under high load.  I grabbed
>a few patches from the git tree that were added after 2.6.16 to fix the
>tty problems I was having.
>
>--
>Len Sorensen
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [EMAIL PROTECTED]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Linux tty driver question

2007-02-17 Thread Mockern
The problem is (probably???) that I did not implement ready_til_block
in my driver. 

OK, thank you, i need to investigate it with strace.
 
>Mockern napsal(a):
>> Thank you, 
>> 
>> I have no problem with my tty driver, except one thing: it does not work 
>> with cat (but there are no problems to write,read from user space 
>> application). I'll try to follow your adwise to support cat. 
>
>And where does it stuck? use ptrace (e.g. strace) to investigate.
>
>regards,

-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Linux tty driver question

2007-02-17 Thread Mockern
Thank you, 

I have no problem with my tty driver, except one thing: it does not work with 
cat (but there are no problems to write,read from user space application). I'll 
try to follow your adwise to support cat. 


>Mockern napsal(a):
>> Hi,
>> 
>> I'm working on Linux tty driver (based on tiny_tty).
>> 
>> How can I provide in my driver Linux cat operation (e.g.cat < ttyS3)?
>
>call tty_insert_flip_*() from somewhere to put some data into tty recieve 
>buffer, which is pushed into ldisc by tty_flip_buffer_push() and then sent by 
>tty_read function (where ldisc read is called) to userspace for reading 
>process.
>
>> What should I implement exactly?
>
>open, settermios, write_room (note that this is minimal and will probably oops 
>when poll or write is invoked) + some isr or timer to fill the buffer 
>mentioned 
>above.
>
>regards,

-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Linux tty driver question

2007-02-17 Thread Mockern
Hi,

I'm working on Linux tty driver (based on tiny_tty).

How can I provide in my driver Linux cat operation (e.g.cat < ttyS3)?

What should I implement exactly?

Thankx
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Linux tty driver question

2007-02-17 Thread Mockern
Hi,

I'm working on Linux tty driver (based on tiny_tty).

How can I provide in my driver Linux cat operation (e.g.cat  ttyS3)?

What should I implement exactly?

Thankx
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Linux tty driver question

2007-02-17 Thread Mockern
Thank you, 

I have no problem with my tty driver, except one thing: it does not work with 
cat (but there are no problems to write,read from user space application). I'll 
try to follow your adwise to support cat. 


Mockern napsal(a):
 Hi,
 
 I'm working on Linux tty driver (based on tiny_tty).
 
 How can I provide in my driver Linux cat operation (e.g.cat  ttyS3)?

call tty_insert_flip_*() from somewhere to put some data into tty recieve 
buffer, which is pushed into ldisc by tty_flip_buffer_push() and then sent by 
tty_read function (where ldisc read is called) to userspace for reading 
process.

 What should I implement exactly?

open, settermios, write_room (note that this is minimal and will probably oops 
when poll or write is invoked) + some isr or timer to fill the buffer 
mentioned 
above.

regards,

-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Linux tty driver question

2007-02-17 Thread Mockern
The problem is (probably???) that I did not implement ready_til_block
in my driver. 

OK, thank you, i need to investigate it with strace.
 
Mockern napsal(a):
 Thank you, 
 
 I have no problem with my tty driver, except one thing: it does not work 
 with cat (but there are no problems to write,read from user space 
 application). I'll try to follow your adwise to support cat. 

And where does it stuck? use ptrace (e.g. strace) to investigate.

regards,

-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: buffer overflows in the tty flip buffer in 2.6.17

2007-02-17 Thread Mockern
Thanx for your respond. 

Could you please inform me what patches exactly you have grabbed?

On Sat, Feb 17, 2007 at 03:29:31PM +0300, Mockern wrote:
 When data is received from the hardware, it needs to be placed into the tty 
 device's flip buffer. This can be done with the following bit of code:
 
 for (i = 0; i  data_size; ++i) {
 if (tty-flip.count = TTY_FLIPBUF_SIZE)
 tty_flip_buffer_push(tty);
 tty_insert_flip_char(tty, data[i], 0);
 }
 tty_flip_buffer_push(tty);
 
 This example makes sure there are no buffer overflows in the tty flip buffer 
 as the data is being added. 
 
 But how it is done in 2.6.17 linux kernel? I did check this overflow code 
 in new tty driver's code. This code looks like just removed. But somehow 
 overflow in the tty buffer must be kept.

Well there was a problem in 2.6.16, which was fixed by 2.6.18, although
I am not sure if it was done by 2.6.17.  It would loose characters due
to buffer overflow and not properly checking under high load.  I grabbed
a few patches from the git tree that were added after 2.6.16 to fix the
tty problems I was having.

--
Len Sorensen
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Analog-to-Digital Converter (ADC) driver

2007-02-17 Thread Mockern
AD7994 4 Channel, 12-Bit ADC with I2C Compatible Interface in 16-Lead TSSOP, 


I think it could be I2C driver 

On 2/17/07, Mockern [EMAIL PROTECTED] wrote:
 Hello,

 Where I can find any ADC driver example?


Depending on what kind of ADC and what you want to do with it,
anything from a simple char device to an ALSA driver could be
appropriate.  Can you provide more information?

Lee
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Analog-to-Digital Converter (ADC) driver

2007-02-17 Thread Mockern
AD7994 4 Channel, 12-Bit ADC with I2C Compatible Interface in 16-Lead
TSSOP, 

I think it could be I2C driver 


On 2/17/07, Mockern [EMAIL PROTECTED] wrote:
 Hello,

 Where I can find any ADC driver example?


Depending on what kind of ADC and what you want to do with it,
anything from a simple char device to an ALSA driver could be
appropriate.  Can you provide more information?

Lee
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


ADC driver with I2C interface

2007-02-17 Thread Mockern

Hello,

Where I can grab an example of ADC driver with I2C interface?
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: bloc_til_ready in tty driver

2007-02-16 Thread Mockern
Thank you very much

>Mockern napsal(a):
>> Thanx for your respond,
>> 
>> I did not implement this function in my tty driver.
>> 
>> Does it help to work my driver with cat Linux operation?
>> (e.g. cat < ttyS10)
>
>Help in which way? If you haven't implemented it, it'll behave like there was 
>O_NONBLOCK passed to open() call or TIOCSSOFTCAR ioctl with nonzero param was 
>invoked.
>
>regards,

-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cat, cp operations for tty driver (like for char one)

2007-02-16 Thread Mockern
Thank you very much


>On Fri, 16 Feb 2007, Mockern wrote:
>
>> Thanx for your respond.
>>
>> Does it mean I have to change nothing in my tty driver
>> (based on serial_core.c) to use: cat and cp? No "nonstandard " special 
>> functions to implement?
>>
>
>Change nothing. It you are making your own, make sure your iocl() function
>returns the same kinds of errors as the in-kernel one.
>
>You can check out the existing in-kernel driver as:
>
>strace cp filename /dev/ttyS0
>
>
>
>>
>>
>>>
>>> On Thu, 15 Feb 2007, Mockern wrote:
>>>
>>>> I have a question about linux tty driver
>>>>
>>>> how to support cp, cat operations in tty driver (like tiny_tty)?
>>>> (e.g. echo "hello tty" > /dev/ttyS3, cat < ttyS10 etc)
>>>>
>>>> There a lot of examples with char drivers, but I could not find it for tty 
>>>> Linux driver.
>>>>
>>>
>>> It works out of the box. Just keep hardware flow-control turned off
>>> if there are no receivers connected to the output port. Also, you need
>>> to set up the port's baud-rate and (usually) to make it transparent to
>>> control characters (man tc-get/set-attr).
>>>
>>> Cheers,
>>> Dick Johnson
>>> Penguin : Linux version 2.6.16.24 on an i686 machine (5592.61 BogoMips).
>>> New book: http://www.AbominableFirebug.com/
>>> _
>>> 
>>>
>>> 
>>> The information transmitted in this message is confidential and may be 
>>> privileged.  Any review, retransmission, dissemination, or other use of 
>>> this information by persons or entities other than the intended recipient 
>>> is prohibited.  If you are not the intended recipient, please notify 
>>> Analogic Corporation immediately - by replying to this message or by 
>>> sending an email to [EMAIL PROTECTED] - and destroy all copies of this 
>>> information, including any attachments, without reading or disclosing them.
>>>
>>> Thank you.
>>
>>
>
>Cheers,
>Dick Johnson
>Penguin : Linux version 2.6.16.24 on an i686 machine (5594.84 BogoMips).
>New book: http://www.AbominableFirebug.com/
>_
>
>
>
>The information transmitted in this message is confidential and may be 
>privileged.  Any review, retransmission, dissemination, or other use of this 
>information by persons or entities other than the intended recipient is 
>prohibited.  If you are not the intended recipient, please notify Analogic 
>Corporation immediately - by replying to this message or by sending an email 
>to [EMAIL PROTECTED] - and destroy all copies of this information, including 
>any attachments, without reading or disclosing them.
>
>Thank you.


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cat, cp operations for tty driver (like for char one)

2007-02-16 Thread Mockern
Thanx for your respond.

Does it mean I have to change nothing in my tty driver (based on serial_core.c) 
to use: cat and cp? No "nonstandard " special functions to implement? 

 

>
>On Thu, 15 Feb 2007, Mockern wrote:
>
>> I have a question about linux tty driver
>>
>> how to support cp, cat operations in tty driver (like tiny_tty)?
>> (e.g. echo "hello tty" > /dev/ttyS3, cat < ttyS10 etc)
>>
>> There a lot of examples with char drivers, but I could not find it for tty 
>> Linux driver.
>>
>
>It works out of the box. Just keep hardware flow-control turned off
>if there are no receivers connected to the output port. Also, you need
>to set up the port's baud-rate and (usually) to make it transparent to
>control characters (man tc-get/set-attr).
>
>Cheers,
>Dick Johnson
>Penguin : Linux version 2.6.16.24 on an i686 machine (5592.61 BogoMips).
>New book: http://www.AbominableFirebug.com/
>_
>
>
>
>The information transmitted in this message is confidential and may be 
>privileged.  Any review, retransmission, dissemination, or other use of this 
>information by persons or entities other than the intended recipient is 
>prohibited.  If you are not the intended recipient, please notify Analogic 
>Corporation immediately - by replying to this message or by sending an email 
>to [EMAIL PROTECTED] - and destroy all copies of this information, including 
>any attachments, without reading or disclosing them.
>
>Thank you.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: bloc_til_ready in tty driver

2007-02-16 Thread Mockern
Thanx for your respond,

I did not implement this function in my tty driver.

Does it help to work my driver with cat Linux operation?
(e.g. cat < ttyS10)


>Mockern napsal(a):
>> What for is "bloc_til_ready" function in tty drivers?
>
>Most drivers waits for hardware to detect carrier and for closed callout.
>
>regards,

-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: bloc_til_ready in tty driver

2007-02-16 Thread Mockern
Thanx for your respond,

I did not implement this function in my tty driver.

Does it help to work my driver with cat Linux operation?
(e.g. cat  ttyS10)


Mockern napsal(a):
 What for is bloc_til_ready function in tty drivers?

Most drivers waits for hardware to detect carrier and for closed callout.

regards,

-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cat, cp operations for tty driver (like for char one)

2007-02-16 Thread Mockern
Thanx for your respond.

Does it mean I have to change nothing in my tty driver (based on serial_core.c) 
to use: cat and cp? No nonstandard  special functions to implement? 

 


On Thu, 15 Feb 2007, Mockern wrote:

 I have a question about linux tty driver

 how to support cp, cat operations in tty driver (like tiny_tty)?
 (e.g. echo hello tty  /dev/ttyS3, cat  ttyS10 etc)

 There a lot of examples with char drivers, but I could not find it for tty 
 Linux driver.


It works out of the box. Just keep hardware flow-control turned off
if there are no receivers connected to the output port. Also, you need
to set up the port's baud-rate and (usually) to make it transparent to
control characters (man tc-get/set-attr).

Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.61 BogoMips).
New book: http://www.AbominableFirebug.com/
_



The information transmitted in this message is confidential and may be 
privileged.  Any review, retransmission, dissemination, or other use of this 
information by persons or entities other than the intended recipient is 
prohibited.  If you are not the intended recipient, please notify Analogic 
Corporation immediately - by replying to this message or by sending an email 
to [EMAIL PROTECTED] - and destroy all copies of this information, including 
any attachments, without reading or disclosing them.

Thank you.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: cat, cp operations for tty driver (like for char one)

2007-02-16 Thread Mockern
Thank you very much


On Fri, 16 Feb 2007, Mockern wrote:

 Thanx for your respond.

 Does it mean I have to change nothing in my tty driver
 (based on serial_core.c) to use: cat and cp? No nonstandard  special 
 functions to implement?


Change nothing. It you are making your own, make sure your iocl() function
returns the same kinds of errors as the in-kernel one.

You can check out the existing in-kernel driver as:

strace cp filename /dev/ttyS0






 On Thu, 15 Feb 2007, Mockern wrote:

 I have a question about linux tty driver

 how to support cp, cat operations in tty driver (like tiny_tty)?
 (e.g. echo hello tty  /dev/ttyS3, cat  ttyS10 etc)

 There a lot of examples with char drivers, but I could not find it for tty 
 Linux driver.


 It works out of the box. Just keep hardware flow-control turned off
 if there are no receivers connected to the output port. Also, you need
 to set up the port's baud-rate and (usually) to make it transparent to
 control characters (man tc-get/set-attr).

 Cheers,
 Dick Johnson
 Penguin : Linux version 2.6.16.24 on an i686 machine (5592.61 BogoMips).
 New book: http://www.AbominableFirebug.com/
 _
 

 
 The information transmitted in this message is confidential and may be 
 privileged.  Any review, retransmission, dissemination, or other use of 
 this information by persons or entities other than the intended recipient 
 is prohibited.  If you are not the intended recipient, please notify 
 Analogic Corporation immediately - by replying to this message or by 
 sending an email to [EMAIL PROTECTED] - and destroy all copies of this 
 information, including any attachments, without reading or disclosing them.

 Thank you.



Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5594.84 BogoMips).
New book: http://www.AbominableFirebug.com/
_



The information transmitted in this message is confidential and may be 
privileged.  Any review, retransmission, dissemination, or other use of this 
information by persons or entities other than the intended recipient is 
prohibited.  If you are not the intended recipient, please notify Analogic 
Corporation immediately - by replying to this message or by sending an email 
to [EMAIL PROTECTED] - and destroy all copies of this information, including 
any attachments, without reading or disclosing them.

Thank you.


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: bloc_til_ready in tty driver

2007-02-16 Thread Mockern
Thank you very much

Mockern napsal(a):
 Thanx for your respond,
 
 I did not implement this function in my tty driver.
 
 Does it help to work my driver with cat Linux operation?
 (e.g. cat  ttyS10)

Help in which way? If you haven't implemented it, it'll behave like there was 
O_NONBLOCK passed to open() call or TIOCSSOFTCAR ioctl with nonzero param was 
invoked.

regards,

-- 
Яндекс.Почта: объем почтового ящика не ограничен! 
http://mail.yandex.ru/monitoring/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/