File: PROBLEMS

package info (click to toggle)
ledcontrol 0.5.2-11.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,016 kB
  • ctags: 270
  • sloc: ansic: 3,264; sh: 1,589; makefile: 181; perl: 49
file content (61 lines) | stat: -rw-r--r-- 2,262 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

This file documents in detail some of the fundamental problems I have
had to face in the making ledcontrol. It's written in a
question-and-answer method, as that's easiest for me to write and
probably clearest for you to read.

HELP IS NEEDED WITH THESE PROBLEMS!!!  If you have any suggestions,
comments, ideas or questions about these problems, please don't
hesitate to contact me (Sampo Niskanen <sampo.niskanen@iki.fi>).



LED SETTING & ROOT
------------------

PROBLEM:

The current implementation requires ledd to be run as root. It opens
/dev/console a hundred times a second and sets the LEDs. After exit it
sets the LEDs normal on pre-defined ttys only (not done yet).

DETAILS:

- Why open the device again and again?

/dev/console is the current console, but when the user changes to
another console, the already-opened devices use the previous
console. This is the only way to always have the current console set. 

- Why 100 times a second?

In X, the settings don't stick. If the user presses some lock-key (or
AltGr), the LEDs are set to their "correct" state. 100 times a second
guarantees the LEDs are mostly correct (though it still flashes when
pressing some such key). I have not discovered how to "ask" X to set a
LED to some state, though the documentation might hint that this is
possible.

- Why does it have to use /dev/console and not /dev/tty* ?

In X (on /dev/tty7), even though I open /dev/tty1 and set the LEDs,
they are set also in X (on /dev/tty7)! I don't know why this is
so. Furthermore, I have not discovered any way to find out the
"correct" LED settings in X, so I have to trust that the ones we don't
set are correct. Therefore, it must use /dev/console and cannot use
any other tty.

- Why separate fixing ttys?

The problems above make it neccessary to use /dev/console, which on
the other hand cannot be used in setting the consoles straight.

POSSIBLE SOLUTIONS:

One possible solution might be checking whether we are on the same
console on which we were the previous time. Then we could set the LEDs
correct automatically when we change console. This would remove the
need for a list of ttys to correct, but doesn't help the root
issue. Can one check whether two opened /dev/console's are really the
same console?