1 #include <lib/system/info.h>
3 #include <lib/base/estring.h>
4 #include <lib/system/init.h>
5 #include <lib/system/init_num.h>
12 #include <lib/dvb/frontend.h>
14 #if HAVE_DVB_API_VERSION == 3
18 eSystemInfo
*eSystemInfo::instance
;
20 eSystemInfo::eSystemInfo()
21 :hashdd(0), hasci(0), hasrfmod(0), haslcd(0), hasnetwork(1)
22 ,haskeyboard(0) ,canmeasurelnbcurrent(0), hasnegfilter(0)
23 ,canupdateTransponder(0), canshutdown(1), canrecordts(0)
24 ,alphaincrement(10), hasstandbywakeuptimer(0), cantimeshift(0)
28 #if HAVE_DVB_API_VERSION == 3
29 int fd
=::open(DEMOD_DEV
, O_RDONLY
);
33 dvb_frontend_info info
;
34 if ( ::ioctl(fd
, FE_GET_INFO
, &info
) >= 0 )
46 fetype
= feTerrestrial
;
51 eDebug("FE_GET_INFO failed (%m)");
55 eDebug("open demod failed (%m)");
58 switch (tuxbox_get_submodel())
60 case TUXBOX_SUBMODEL_DREAMBOX_DM7000
:
61 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recDVR
;
62 canupdateTransponder
= canrecordts
= hashdd
=
63 haslcd
= canmeasurelnbcurrent
=
66 // caids.insert(0x4a70);
70 cpustr
="STB04500, 252MHz";
72 case TUXBOX_SUBMODEL_DBOX2
:
73 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recDVR
;
78 hasstandbywakeuptimer
=haslcd
=1;
81 cpustr
="XPC823, 66MHz";
82 switch ( tuxbox_get_vendor() )
84 case TUXBOX_VENDOR_NOKIA
:
89 case TUXBOX_VENDOR_PHILIPS
:
91 hwtype
= dbox2Philips
;
92 manufactstr
="Philips";
94 case TUXBOX_VENDOR_SAGEM
:
108 int mid
= atoi(getInfo("mID").c_str());
116 manufactstr
="Dream-Multimedia-TV";
118 canupdateTransponder
=haskeyboard
=1;
119 caids
.insert(0x4a70);
125 cpustr
="STB04500, 252MHz";
126 hashdd
= haslcd
= canmeasurelnbcurrent
= hasci
127 = canrecordts
= cantimeshift
= 1;
129 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recDVR
;
131 // check if new FP Firmware is avail...
132 int fd
= open("/dev/dbox/fp0", O_RDWR
);
135 #define FP_IOCTL_GET_ID 0
136 int ret
= ::ioctl(fd
,FP_IOCTL_GET_ID
);
138 eDebug("old fp driver.. no support for wakeup timer");
140 eDebug("old fp firmware... no support for wakeup timer");
142 hasstandbywakeuptimer
=1;
149 cpustr
="STBx25xx, 252MHz";
153 hwtype
= getInfo("type", true) == "DM5600" ? DM5600
: DM5620
;
154 if ( hwtype
== DM5600
)
156 defaulttimertype
=ePlaylistEntry::SwitchTimerEntry
;
163 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recNgrab
;
168 cpustr
="STBx25xx, 252MHz";
171 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recNgrab
;
172 canshutdown
=canrecordts
=hasscartswitch
=0;
179 cpustr
="STB04500, 252MHz";
180 hasrfmod
= hashdd
= haslcd
= hasci
181 = canrecordts
= hasstandbywakeuptimer
= cantimeshift
= 1;
182 // check if the box revision is new enough to measure
183 // lnb power with > 13V ( revisions with lnbp21 can this )
184 int fd
= open("/dev/dbox/fp0", O_RDWR
);
187 if ( ::ioctl( fd
, 0x100, 0 ) == 0 )
188 canmeasurelnbcurrent
=1;
190 canmeasurelnbcurrent
=2;
194 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recDVR
;
202 cpustr
="STBx25xx, 252MHz";
203 hashdd
= canrecordts
= cantimeshift
= 1;
206 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recDVR
;
213 modelstr
="DM500PLUS";
214 cpustr
="STBx25xx, 252MHz";
215 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recNgrab
;
216 canrecordts
=hasscartswitch
=0;
225 cpustr
="XPC823, 66MHz";
226 caids
.insert(0x1702);
227 caids
.insert(0x1722);
228 caids
.insert(0x1762);
229 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recNgrab
;
230 hasstandbywakeuptimer
=haslcd
=1;
239 manufactstr
="Philips";
241 hwtype
= dbox2Philips
;
256 cpustr
="STBx25xx, 252MHz";
259 defaulttimertype
=ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recNgrab
;
261 haskeyboard
=canupdateTransponder
=1;
263 caids
.insert(0x4a70);
269 int fd
= open ("/dev/rfmod0", O_RDWR
);
275 fd
= open("/dev/dvb/card0/demux0", O_RDWR
);
278 if ( ::ioctl( fd
, DMX_SET_NEGFILTER_MASK
, 0 ) >= 0 )
282 if ( hwtype
< DM7000
)
284 switch (atoi(getInfo("fe").c_str()))
286 case 0: // DBOX_FE_CABLE
289 case 1: // DBOX_FE_SATELLITE
299 int fd
=::open(DEMOD_DEV
, O_RDONLY
);
303 fetype
= feSatellite
; // default
304 if ( ::ioctl(fd
, FE_GET_INFO
, &info
) >= 0 )
309 fetype
= feSatellite
;
315 fetype
= feTerrestrial
;
320 eDebug("FE_GET_INFO failed (%m)");
327 #if HAVE_DVB_API_VERSION < 3
328 eString
eSystemInfo::getInfo(const char *info
, bool dreambox
)
332 f
=fopen("/proc/bus/dreambox", "rt");
334 f
=fopen("/proc/bus/dbox", "rt");
341 if (!fgets(buffer
, 128, f
))
344 buffer
[strlen(buffer
)-1]=0;
345 if ((!strncmp(buffer
, info
, strlen(info
)) && (buffer
[strlen(info
)]=='=')))
347 int i
= strlen(info
)+1;
348 result
= eString(buffer
).mid(i
, strlen(buffer
)-i
);
357 eAutoInitP0
<eSystemInfo
> init_info(eAutoInitNumbers::sysinfo
, "SystemInfo");