-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathe2_proc_main.c
963 lines (837 loc) · 34.6 KB
/
e2_proc_main.c
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
/*
* e2_proc_main.c
*
* (c) 2009 teamducktales
*
* 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; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* Description:
*
* progress
* |
* bus
* |
* ----------- nim_sockets
* |
* stb
* |
* ----------- audio
* | |
* | --------- ac3
* | |
* | --------- audio_delay_pcm
* | |
* | --------- audio_delay_bitstream
* | |
* | --------- audio_j1_mute
* | |
* | --------- ac3_choices
* | |
* | ---------
* |
* ----------- video
* | |
* | --------- alpha
* | |
* | --------- aspect
* | |
* | --------- aspect_choices
* | |
* | --------- hdmi_colorspace
* | |
* | --------- hdmi_colorspace_choices
* | |
* | --------- force_dvi
* | |
* | --------- policy
* | |
* | --------- policy_choices
* | |
* | --------- videomode
* | |
* | --------- videomode_50hz
* | |
* | --------- videomode_60hz
* | |
* | --------- videomode_choices
* | |
* | --------- videomode_preferred
* | |
* | --------- pal_v_start
* | |
* | --------- pal_v_end
* | |
* | --------- pal_h_start
* | |
* | --------- pal_h_end
* |
* ---------- avs
* | |
* | --------- 0
* | |
* | --------- colorformat <-colorformat in generlell, hdmi and scart
* | |
* | --------- colorformat_choices
* | |
* | --------- fb <-fastblanking
* | |
* | --------- sb <-slowblanking
* | |
* | --------- volume
* | |
* | --------- input <-Input, Scart VCR Input or Encoder
* | |
* | --------- input_choices
* | |
* | --------- standby
* |
* ---------- denc
* | |
* | --------- 0
* | |
* | --------- wss
* | |
* | ---------
* | |
* | ---------
* |
* ---------- fp (this is wrong used for e2 I think. on dm800 this is frontprocessor and there is another proc entry for frontend)
* | |
* | --------- lnb_sense1
* | |
* | --------- lnb_sense2
* | |
* | --------- led0_pattern
* | |
* | --------- led_pattern_speed
* | |
* | |
* | --------- version
* | |
* | --------- wakeup_time <- dbox frontpanel wakeuptime
* | |
* | --------- was_timer_wakeup
* |
* |
* ---------- hdmi
* | |
* | --------- bypass_edid_checking
* | |
* | --------- enable_hdmi_resets
* | |
* | --------- audio_source
* | |
* | ---------
* |
* ---------- info
* | |
* | --------- model <- Version String of out Box
* |
* ---------- tsmux
* | |
* | --------- input0
* | |
* | --------- input1
* | |
* | --------- ci0_input
* | |
* | --------- ci1_input
* | |
* | --------- lnb_b_input
* | |
* | ---------
* |
* ---------- misc
* | |
* | --------- 12V_output
* |
* ---------- tuner (dagoberts tuner entry ;-) )
* | |
* | ---------
* |
* ---------- vmpeg
* | |
* | --------- 0/1
* | |
* | --------- dst_left \
* | | |
* | --------- dst_top |
* | | > PIG WINDOW SIZE AND POSITION
* | --------- dst_width |
* | | |
* | --------- dst_height /
* | |
* | --------- dst_all (Dagobert: Dont confuse player by setting value one after each other)
* |
* | |TODO
* | | v
* | --------- yres
* | |
* | --------- xres
* | |
* | --------- framerate
* | |
* | --------- progressive
* | |
* | --------- aspect
* | |
* | --------- pep_apply
* |
* ---------- fb
* | |
* | --------- 3dmode
* | |
* | --------- znorm
* | |
* | --------- dst_left \
* | | |
* | --------- dst_top |
* | | > PIG WINDOW SIZE AND POSITION
* | --------- dst_width |
* | | |
* | --------- dst_height /
*
*/
#include <linux/proc_fs.h> /* proc fs */
#include <asm/uaccess.h> /* copy_from_user */
#include <linux/version.h>
#include <linux/string.h>
#include <linux/module.h>
typedef int (*proc_read_t) (char *page, char **start, off_t off, int count,
int *eof, void *data_unused);
typedef int (*proc_write_t) (struct file *file, const char __user *buf,
unsigned long count, void *data);
#define cProcDir 1
#define cProcEntry 2
struct ProcStructure_s
{
int type;
char* name;
struct proc_dir_entry* entry;
proc_read_t read_proc;
proc_write_t write_proc;
void* instance; /* needed for cpp stuff */
void* identifier; /* needed for cpp stuff */
};
static int get_player_version(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
#if defined(PLAYER_191)
int len = sprintf(page, "player191\n");
#else
int len = sprintf(page, "unknown\n");
#endif
return len;
}
static int info_model_read(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
#if defined(SPARK)
int len = sprintf(page, "spark\n");
#elif defined(HL101)
int len = sprintf(page, "hl101\n");
#elif defined(SPARK7162)
int len = sprintf(page, "spark7162\n");
#endif
return len;
}
static char* three_d_mode = NULL;
static int three_d_mode_read(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
int len = 0;
if(three_d_mode == NULL){
len = sprintf(page, "off\n");
}else{
len = sprintf(page, three_d_mode);
}
return len;
}
static int three_d_mode_write(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
char *page;
ssize_t ret = -ENOMEM;
char* myString = kmalloc(count + 1, GFP_KERNEL);
printk("%s %ld - ", __FUNCTION__, count);
page = (char *)__get_free_page(GFP_KERNEL);
if (page)
{
ret = -EFAULT;
if (copy_from_user(page, buf, count))
goto out;
strncpy(myString, page, count);
myString[count] = '\0';
printk("%s\n", myString);
if (strncmp("sbs", myString, 3) == 0 || strncmp("sidebyside", myString, 10) == 0)
{
if(three_d_mode != NULL) kfree(three_d_mode);
three_d_mode = myString;
}
else if (strncmp("tab", myString, 3) == 0 || strncmp("topandbottom", myString, 12) == 0)
{
if(three_d_mode != NULL) kfree(three_d_mode);
three_d_mode = myString;
}
else if (strncmp("off", myString, 3) == 0 || strncmp("auto", myString, 4) == 0)
{
if(three_d_mode != NULL) kfree(three_d_mode);
three_d_mode = myString;
}
/* always return count to avoid endless loop */
ret = count;
}
out:
free_page((unsigned long)page);
if(three_d_mode != myString) kfree(myString);
return ret;
}
static char* wakeup_time = NULL;
static int wakeup_time_read(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
int len = 0;
if (wakeup_time == NULL)
len = sprintf(page, "%ld", LONG_MAX);
else
len = sprintf(page, wakeup_time);
return len;
}
static int wakeup_time_write(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
char *page;
ssize_t ret = -ENOMEM;
char* myString = kmalloc(count + 1, GFP_KERNEL);
printk("%s %ld - ", __FUNCTION__, count);
page = (char *)__get_free_page(GFP_KERNEL);
if (page)
{
ret = -EFAULT;
if (copy_from_user(page, buf, count))
goto out;
strncpy(myString, page, count);
myString[count] = '\0';
printk("%s\n", myString);
if(wakeup_time != NULL) kfree(wakeup_time);
wakeup_time = myString;
/* always return count to avoid endless loop */
ret = count;
}
out:
free_page((unsigned long)page);
if(wakeup_time != myString) kfree(myString);
return ret;
}
int _12v_isON=0;
int proc_misc_12V_output_write(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
char *page;
ssize_t ret = -ENOMEM;
char *myString;
printk("%s %ld\n", __FUNCTION__, count);
page = (char *)__get_free_page(GFP_KERNEL);
if (page)
{
ret = -EFAULT;
if (copy_from_user(page, buf, count))
goto out;
page[count] = 0;
//printk("%s", page);
myString = (char *) kmalloc(count + 1, GFP_KERNEL);
strncpy(myString, page, count);
myString[count] = '\0';
if(!strncmp("on", myString, count))
_12v_isON=1;
if(!strncmp("off", myString, count))
_12v_isON=0;
kfree(myString);
ret = count;
}
ret = count;
out:
free_page((unsigned long)page);
return ret;
}
EXPORT_SYMBOL(_12v_isON);
int proc_misc_12V_output_read (char *page, char **start, off_t off, int count,
int *eof, void *data_unused)
{
int len = 0;
printk("%s %d\n", __FUNCTION__, count);
if(_12v_isON)
len = sprintf(page, "on\n");
else
len = sprintf(page, "off\n");
return len;
}
static int zero_read(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
int len = sprintf(page, "0");
return len;
}
static int default_write_proc(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
return count;
}
struct ProcStructure_s e2Proc[] =
{
{cProcEntry, "progress" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "bus/nim_sockets" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/audio" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/audio/ac3" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/audio/audio_delay_pcm" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/audio/audio_delay_bitstream" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/audio/j1_mute" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/audio/ac3_choices" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/info" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/info/model" , NULL, info_model_read, NULL, NULL, ""},
{cProcEntry, "stb/info/boxtype" , NULL, info_model_read, NULL, NULL, ""},
{cProcDir , "stb/video" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/alpha" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/aspect" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/aspect_choices" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/hdmi_colorspace" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/hdmi_colorspace_choices" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/force_dvi" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/policy" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/policy_choices" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/videomode" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/3d_mode" , NULL, three_d_mode_read, three_d_mode_write, NULL, ""},
{cProcEntry, "stb/video/videomode_50hz" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/videomode_60hz" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/videomode_choices" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/videomode_preferred" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/pal_v_start" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/pal_v_end" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/pal_h_start" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/pal_h_end" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/avs" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/avs/0" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/colorformat" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/colorformat_choices" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/fb" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/input" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/sb" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/volume" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/input_choices" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/avs/0/standby" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/denc" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/denc/0" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/denc/0/wss" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/fb" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fb/dst_left" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fb/dst_top" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fb/dst_width" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fb/dst_height" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fb/3dmode" , NULL, three_d_mode_read, three_d_mode_write, NULL, ""},
{cProcEntry, "stb/fb/znorm" , NULL, NULL, default_write_proc, NULL, ""},
{cProcDir , "stb/fp" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fp/lnb_sense1" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fp/lnb_sense2" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fp/led0_pattern" , NULL, NULL, default_write_proc, NULL, ""},
{cProcEntry, "stb/fp/led_pattern_speed" , NULL, NULL, default_write_proc, NULL, ""},
{cProcEntry, "stb/fp/version" , NULL, zero_read, NULL, NULL, ""},
{cProcEntry, "stb/fp/wakeup_time" , NULL, wakeup_time_read, wakeup_time_write, NULL, ""},
{cProcEntry, "stb/fp/was_timer_wakeup" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/fp/rtc" , NULL, zero_read, default_write_proc, NULL, ""},
{cProcDir , "stb/tsmux" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/tsmux/input0" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/tsmux/input1" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/tsmux/ci0_input" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/tsmux/ci1_input" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/tsmux/lnb_b_input" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/misc" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/misc/12V_output" , NULL, proc_misc_12V_output_read, proc_misc_12V_output_write, NULL, ""},
{cProcDir , "stb/vmpeg" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/vmpeg/0" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/dst_apply" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/dst_left" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/dst_top" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/dst_width" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/dst_height" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/dst_all" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/yres" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/xres" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/aspect" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/framerate" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/0/pep_apply" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/vmpeg/1" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/dst_apply" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/dst_left" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/dst_top" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/dst_width" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/dst_height" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/dst_all" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/yres" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/xres" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/aspect" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/framerate" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/vmpeg/1/pep_apply" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/hdmi" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/hdmi/bypass_edid_checking" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/hdmi/enable_hdmi_resets" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/hdmi/output" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/hdmi/output_choices" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/hdmi/audio_source" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/hdmi/audio_source_choices" , NULL, NULL, NULL, NULL, ""},
{cProcDir, "stb/stream" , NULL, NULL, NULL, NULL, ""},
{cProcDir, "stb/stream/policy" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/stream/policy/AV_SYNC" , NULL, NULL, NULL, NULL, "AV_SYNC"},
{cProcEntry, "stb/stream/policy/TRICK_MODE_AUDIO" , NULL, NULL, NULL, NULL, "TRICK_MODE_AUDIO"},
{cProcEntry, "stb/stream/policy/PLAY_24FPS_VIDEO_AT_25FPS" , NULL, NULL, NULL, NULL, "PLAY_24FPS_VIDEO_AT_25FPS"},
{cProcEntry, "stb/stream/policy/MASTER_CLOCK" , NULL, NULL, NULL, NULL, "MASTER_CLOCK"},
{cProcEntry, "stb/stream/policy/EXTERNAL_TIME_MAPPING" , NULL, NULL, NULL, NULL, "EXTERNAL_TIME_MAPPING"},
{cProcEntry, "stb/stream/policy/DISPLAY_FIRST_FRAME_EARLY" , NULL, NULL, NULL, NULL, "DISPLAY_FIRST_FRAME_EARLY"},
{cProcEntry, "stb/stream/policy/STREAM_ONLY_KEY_FRAMES" , NULL, NULL, NULL, NULL, "STREAM_ONLY_KEY_FRAMES"},
{cProcEntry, "stb/stream/policy/STREAM_SINGLE_GROUP_BETWEEN_DISCONTINUITIES" , NULL, NULL, NULL, NULL, "STREAM_SINGLE_GROUP_BETWEEN_DISCONTINUITIES"},
{cProcEntry, "stb/stream/policy/PLAYOUT_ON_TERMINATE" , NULL, NULL, NULL, NULL, "PLAYOUT_ON_TERMINATE"},
{cProcEntry, "stb/stream/policy/PLAYOUT_ON_SWITCH" , NULL, NULL, NULL, NULL, "PLAYOUT_ON_SWITCH"},
{cProcEntry, "stb/stream/policy/PLAYOUT_ON_DRAIN" , NULL, NULL, NULL, NULL, "PLAYOUT_ON_DRAIN"},
{cProcEntry, "stb/stream/policy/TRICK_MODE_DOMAIN" , NULL, NULL, NULL, NULL, "TRICK_MODE_DOMAIN"},
{cProcEntry, "stb/stream/policy/DISCARD_LATE_FRAMES" , NULL, NULL, NULL, NULL, "DISCARD_LATE_FRAMES"},
{cProcEntry, "stb/stream/policy/REBASE_ON_DATA_DELIVERY_LATE" , NULL, NULL, NULL, NULL, "REBASE_ON_DATA_DELIVERY_LATE"},
{cProcEntry, "stb/stream/policy/REBASE_ON_FRAME_DECODE_LATE" , NULL, NULL, NULL, NULL, "REBASE_ON_FRAME_DECODE_LATE"},
{cProcEntry, "stb/stream/policy/LOWER_CODEC_DECODE_LIMITS_ON_FRAME_DECODE_LATE" , NULL, NULL, NULL, NULL, "LOWER_CODEC_DECODE_LIMITS_ON_FRAME_DECODE_LATE"},
{cProcEntry, "stb/stream/policy/H264_ALLOW_NON_IDR_RESYNCHRONIZATION" , NULL, NULL, NULL, NULL, "H264_ALLOW_NON_IDR_RESYNCHRONIZATION"},
{cProcEntry, "stb/stream/policy/MPEG2_IGNORE_PROGESSIVE_FRAME_FLAG" , NULL, NULL, NULL, NULL, "MPEG2_IGNORE_PROGESSIVE_FRAME_FLAG"},
{cProcDir, "stb/video/plane" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/video/plane/psi_brightness" , NULL, NULL, NULL, NULL, "psi_brightness"},
{cProcEntry, "stb/video/plane/psi_saturation" , NULL, NULL, NULL, NULL, "psi_saturation"},
{cProcEntry, "stb/video/plane/psi_contrast" , NULL, NULL, NULL, NULL, "psi_contrast"},
{cProcEntry, "stb/video/plane/psi_tint" , NULL, NULL, NULL, NULL, "psi_tint"},
{cProcEntry, "stb/video/plane/psi_apply" , NULL, NULL, NULL, NULL, "psi_apply"},
{cProcDir , "stb/cec" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/cec/state_activesource" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/cec/state_standby" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/cec/state_cecaddress" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/cec/onetouchplay" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/cec/systemstandby" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/cec/event_poll" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/cec/send" , NULL, NULL, NULL, NULL, ""},
{cProcDir , "stb/player" , NULL, NULL, NULL, NULL, ""},
{cProcEntry, "stb/player/version" , NULL, get_player_version, NULL, NULL, ""},
};
static int cpp_read_proc(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
int i;
/* find the entry */
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
if (e2Proc[i].identifier != NULL)
if (strlen(e2Proc[i].identifier) > 0)
if (strcmp(e2Proc[i].identifier, data) == 0)
if (e2Proc[i].read_proc != NULL)
return e2Proc[i].read_proc(page, start, off, count, eof, e2Proc[i].instance);
}
return 0;
}
/* we need this functions because the cpp modules cannot inlcude
* the linux kernel headers and therefor we miss some functions
* (e.g. copy_from_user)
* so we make here the dirty stuff and then call the c-function
* in the cpp module which can cast the instance and call the
* real method ;-)
*/
static int cpp_write_proc(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
int i;
char *page;
ssize_t ret = -ENOMEM;
page = (char *)__get_free_page(GFP_KERNEL);
if (page)
{
ret = -EFAULT;
if (copy_from_user(page, buf, count))
goto out;
/* find the entry */
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
if (e2Proc[i].identifier != NULL)
if (strlen(e2Proc[i].identifier) > 0)
if (strcmp(e2Proc[i].identifier, data) == 0)
if (e2Proc[i].write_proc != NULL)
ret = e2Proc[i].write_proc(file, (const char __user *) page, count, e2Proc[i].instance);
}
}
out:
free_page((unsigned long)page);
return ret;
}
struct proc_dir_entry * find_proc_dir(char * name)
{
int i;
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
if((e2Proc[i].type == cProcDir) && (strcmp(name, e2Proc[i].name) == 0))
return e2Proc[i].entry;
}
return NULL;
}
/* the function returns the directry name */
char * dirname(char * name)
{
static char path[100];
int i = 0;
int pos = 0;
while((i < sizeof(path)) && (name[i] != 0))
{
if(name[i] == '/')
pos = i;
path[i] = name[i];
i++;
}
path[i] = 0;
path[pos] = 0;
return path;
}
/* the function returns the base name */
char * basename(char * name)
{
int i = 0;
int pos = 0;
while(name[i] != 0)
{
if(name[i] == '/')
pos = i;
i++;
}
if(name[pos] == '/')
pos++;
return name + pos;
}
int install_e2_procs(char *path, read_proc_t *read_func, write_proc_t *write_func, void *data)
{
int i;
/* find the entry */
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
if((e2Proc[i].type == cProcEntry) &&
(strcmp(path, e2Proc[i].name) == 0))
{
if(e2Proc[i].entry == NULL)
{
printk("%s(): entry not available '%s'\n", __func__, path);
}
else
{
/* check whther the default entry is installed */
if((e2Proc[i].entry->read_proc != e2Proc[i].read_proc) ||
(e2Proc[i].entry->write_proc != e2Proc[i].write_proc))
{
printk("%s(): entry already in use '%s'\n", __func__, path);
}
else
{
/* install the provided functions */
e2Proc[i].entry->read_proc = read_func;
e2Proc[i].entry->write_proc = write_func;
e2Proc[i].entry->data = data;
}
}
break;
}
}
if(i == sizeof(e2Proc) / sizeof(e2Proc[0]))
{
printk("%s(): entry not found '%s'\n", __func__, path);
}
return 0;
}
EXPORT_SYMBOL(install_e2_procs);
int cpp_install_e2_procs(const char *path, read_proc_t *read_func, write_proc_t *write_func, void* instance)
{
int i;
printk("%s: %s\n", __func__, path);
/* find the entry */
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
if((e2Proc[i].type == cProcEntry) &&
(strcmp(path, e2Proc[i].name) == 0))
{
if(e2Proc[i].entry == NULL)
{
printk("%s(): entry not available '%s'\n", __func__, path);
//dagobert: i would prefer to make this dynamic for player purpose
//it would be nice I think; think on it later!!!!!!!
}
else
{
/* install the provided functions */
e2Proc[i].entry->read_proc = cpp_read_proc;
e2Proc[i].entry->write_proc = cpp_write_proc;
e2Proc[i].entry->data = e2Proc[i].identifier;
e2Proc[i].read_proc = read_func;
e2Proc[i].write_proc = write_func;
e2Proc[i].instance = instance;
}
break;
}
}
if(i == sizeof(e2Proc) / sizeof(e2Proc[0]))
{
printk("%s(): entry not found '%s'\n", __func__, path);
}
return 0;
}
EXPORT_SYMBOL(cpp_install_e2_procs);
int remove_e2_procs(char *path, read_proc_t *read_func, write_proc_t *write_func)
{
int i;
/* find the entry */
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
if((e2Proc[i].type == cProcEntry) &&
(strcmp(path, e2Proc[i].name) == 0))
{
if(e2Proc[i].entry == NULL)
{
printk("%s(): entry not available '%s'\n", __func__, path);
}
else
{
/* replace the entry with the default */
if(e2Proc[i].entry->read_proc == read_func)
e2Proc[i].entry->read_proc = e2Proc[i].read_proc;
else
printk("%s(): different read_procs '%s' (%p, %p)\n",
__func__, path, e2Proc[i].entry->read_proc, read_func);
if(e2Proc[i].entry->write_proc == write_func)
e2Proc[i].entry->write_proc = e2Proc[i].write_proc;
else
printk("%s(): different write_procs '%s' (%p, %p)\n",
__func__, path, e2Proc[i].entry->write_proc, write_func);
}
break;
}
}
if(i == sizeof(e2Proc) / sizeof(e2Proc[0]))
{
printk("%s(): entry not found '%s'\n", __func__, path);
}
return 0;
}
EXPORT_SYMBOL(remove_e2_procs);
int cpp_remove_e2_procs(const char *path, read_proc_t *read_func, write_proc_t *write_func)
{
int i;
/* find the entry */
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
if((e2Proc[i].type == cProcEntry) &&
(strcmp(path, e2Proc[i].name) == 0))
{
if(e2Proc[i].entry == NULL)
{
printk("%s(): entry not available '%s'\n", __func__, path);
}
else
{
e2Proc[i].instance = NULL;
if(e2Proc[i].read_proc == read_func)
{
e2Proc[i].read_proc = NULL;
printk("%s(): removed '%s, %s' (%p, %p)\n",
__func__, path, e2Proc[i].name, e2Proc[i].read_proc, read_func);
}
else
printk("%s(): different read_procs '%s, %s' (%p, %p)\n",
__func__, path, e2Proc[i].name, e2Proc[i].read_proc, read_func);
if(e2Proc[i].write_proc == write_func)
e2Proc[i].write_proc = NULL;
else
printk("%s(): different write_procs '%s' (%p, %p)\n",
__func__, path, e2Proc[i].write_proc, write_func);
}
break;
}
}
if(i == sizeof(e2Proc) / sizeof(e2Proc[0]))
{
printk("%s(): entry not found '%s'\n", __func__, path);
}
return 0;
}
EXPORT_SYMBOL(cpp_remove_e2_procs);
static int __init e2_proc_init_module(void)
{
int i;
char *path;
char *name;
for(i = 0; i < sizeof(e2Proc) / sizeof(e2Proc[0]); i++)
{
path = dirname(e2Proc[i].name);
name = basename(e2Proc[i].name);
switch(e2Proc[i].type)
{
case cProcDir:
e2Proc[i].entry = proc_mkdir(name, find_proc_dir(path));
if(e2Proc[i].entry == NULL)
{
printk("%s(): could not create entry %s\n", __func__, e2Proc[i].name);
}
break;
case cProcEntry:
if(strcmp("bus", path) == 0)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
e2Proc[i].entry = create_proc_entry(name, 0, proc_bus);
#else
e2Proc[i].entry = create_proc_entry(e2Proc[i].name, 0, NULL);
#endif
}
else
{
e2Proc[i].entry = create_proc_entry(name, 0, find_proc_dir(path));
}
if(e2Proc[i].entry != NULL)
{
e2Proc[i].entry->read_proc = e2Proc[i].read_proc;
e2Proc[i].entry->write_proc = e2Proc[i].write_proc;
}
else
{
printk("%s(): could not create entry %s\n", __func__, e2Proc[i].name);
}
break;
default:
printk("%s(): invalid type %d\n", __func__, e2Proc[i].type);
}
}
return 0;
}
static void __exit e2_proc_cleanup_module(void)
{
int i;
char *name;
for(i = sizeof(e2Proc)/sizeof(e2Proc[0]) - 1; i >= 0; i--)
{
name = basename(e2Proc[i].name);
remove_proc_entry(name, e2Proc[i].entry->parent);
}
}
module_init(e2_proc_init_module);
module_exit(e2_proc_cleanup_module);
MODULE_DESCRIPTION("procfs module with enigma2 support");
MODULE_AUTHOR("Team Ducktales");
MODULE_LICENSE("GPL");