Project

General

Profile

Tvheadend oscam ziggo » History » Version 27

Adam Sutton, 2012-08-23 10:34

1 27 Adam Sutton
Note: this page may be very out of date.
2
3 1 William Peters
This article describes how to build and configure oscam.
4 10 William Peters
5 9 William Peters
Note that this oscam configuration is configured to work with Ziggo as provider.
6
It might work with other providers, but that needs to be confirmed.
7 1 William Peters
8
Make sure you have cmake and subversion installed, these are required for checking out and building oscam.
9
10 19 William Peters
Create a user for oscam and add it to the uucp group
11
12 23 ruud -
<pre>
13 19 William Peters
useradd oscam -s /sbin/nologin -m -d /opt/oscam/
14
gpasswd -a oscam uucp
15 23 ruud -
</pre>
16 19 William Peters
17 1 William Peters
create the required directories
18
19 23 ruud -
<pre>
20 19 William Peters
mkdir /opt/oscam/src/
21 23 ruud -
</pre>
22 1 William Peters
23
Now we need to checkout the oscam source code using SVN
24
25 23 ruud -
<pre>
26 17 William Peters
svn co http://streamboard.gmc.to/svn/oscam /opt/oscam/src/
27 23 ruud -
</pre>
28 1 William Peters
29 17 William Peters
Now we need to configure oscam
30 23 ruud -
<pre>
31 20 ruud -
cd /opt/oscam/src/trunk
32 17 William Peters
./config.sh
33 23 ruud -
</pre>
34 17 William Peters
35
This is my configuration
36 23 ruud -
<pre>
37 17 William Peters
Addons:
38
  [*] WEBIF
39
  [*] HAVE_DVBAPI
40
  [*] IRDETO_GUESSING
41
  [*] CS_ANTICASC
42
  [*] WITH_DEBUG
43
  [ ] CS_WITH_DOUBLECHECK
44
  [*] CS_LED
45
  [*] CS_LOGHISTORY
46
47
Protocols:
48
  [*] MODULE_CAMD33
49
  [*] MODULE_CAMD35
50
  [*] MODULE_CAMD35_TCP
51
  [*] MODULE_NEWCAMD
52
  [*] MODULE_CCCAM
53
  [*] MODULE_RADEGAST
54
  [*] MODULE_SERIAL
55
  [*] MODULE_MONITOR
56
  [*] MODULE_CONSTCW
57
58
Reader:
59
  [*] READER_NAGRA
60
  [*] READER_IRDETO
61
  [*] READER_CONAX
62
  [*] READER_CRYPTWORKS
63
  [*] READER_SECA
64
  [*] READER_VIACCESS
65
  [*] READER_VIDEOGARD
66
  [*] READER_DRE
67
  [*] READER_TONGFANG
68 23 ruud -
</pre>
69 17 William Peters
70
Now compile oscam
71 23 ruud -
<pre>
72 1 William Peters
make
73 23 ruud -
</pre>
74 2 William Peters
75 18 William Peters
After oscam is built you should have a file like 'oscam-1.00-unstable_svnxxxx-i686-pc-linux' in /opt/oscam/src/Distribution/.
76 2 William Peters
We need to copy this file to an alternate location
77
78 23 ruud -
<pre>
79 2 William Peters
cd /opt/oscam/src/Distribution/
80 21 ruud -
cp ./oscam-* /opt/oscam/oscam.bin
81 23 ruud -
</pre>
82 2 William Peters
83
Ok, the binaries are installed :)
84
Now we need to configure oscam first create the configuration directories
85
86 23 ruud -
<pre>
87 2 William Peters
mkdir -p /opt/oscam/etc/
88
mkdir -p /opt/oscam/etc/cw/
89 23 ruud -
</pre>
90 2 William Peters
91
Note: /opt/oscam/etc/cw/ is used for caching keys. 
92
93 1 William Peters
Now, create oscam.conf in /opt/oscam/etc/oscam.conf
94 22 ruud -
95 21 ruud -
Note: replace example CAID with your own CAID (e.g. 0602)
96 2 William Peters
97 23 ruud -
<pre>
98 1 William Peters
[global]
99 14 William Peters
usrfile                       = /opt/oscam/oscamuser.log
100
logfile                       = /opt/oscam/oscam.log
101
cwlogdir                      = /opt/oscam/etc/cw
102
disablelog                    = 0
103
disableuserfile               = 0
104
usrfileflag                   = 0
105
clienttimeout                 = 2000
106
fallbacktimeout               = 1500
107
clientmaxidle                 = 120
108
failbantime                   = 0
109
bindwait                      = 120
110
netprio                       = 0
111
clientdyndns                  = 0
112
resolvedelay                  = 2
113
unlockparental                = 0
114
nice                          = -1
115
serialreadertimeout           = 1000
116
maxlogsize                    = 10
117
waitforcards                  = 1
118
preferlocalcards              = 1
119
saveinithistory               = 0
120
readerrestartseconds          = 5
121
lb_mode                       = 0
122 1 William Peters
lb_save                       = 0
123 14 William Peters
lb_nbest_readers              = 1
124
lb_nfb_readers                = 1
125
lb_min_ecmcount               = 5
126
lb_max_ecmcount               = 500
127
lb_reopen_seconds             = 900
128
resolvegethostbyname          = 0
129 1 William Peters
130
[newcamd]
131 14 William Peters
port                          = 15050@0604:000000
132
key                           = 0102030405060708091011121314
133
allowed                       =
134
keepalive                     = 1
135
mgclient                      = 0
136
137
[webif]
138
httpport                      = 15080
139
httpuser                      = username
140
httppwd                       = password
141
httprefresh                   = 0
142
httpallowed                   = 127.0.0.1,YourIpRange
143
httphideidleclients           = 0
144
httpreadonly                  = 0
145 23 ruud -
</pre>
146 1 William Peters
147
Now create oscam.server in /opt/oscam/etc/oscam.server
148
149 23 ruud -
<pre>
150 1 William Peters
[reader]
151
Label = Ziggo
152
Device = /dev/ttyUSB0
153
mhz = 600
154
cardmhz = 600
155
Protocol = mouse
156
EMMCache = 1,3,2
157
Group = 1
158
caid = 0604:0000
159
rsakey = 3C8633AAC0D367533DEC7BB2EEEDEB8CA3ADA52E58B99BB34672783277A1DAAC3B6106AD0909774E031B2A6E30195B437683AD0FC599B87D08CEA47BE1B6C76A
160
boxkey = 1122334455667788
161
fallback = 0
162 23 ruud -
</pre>
163 1 William Peters
164
Now create oscam.user in /opt/oscam/etc/oscam.user
165
166 23 ruud -
<pre>
167 1 William Peters
[account]
168
user = tvheadend
169
pwd = tvheadend
170
uniq = 0
171
group = 1
172
ident = 0604:000000
173
caid = 0604
174
au = Ziggo
175 23 ruud -
</pre>
176 1 William Peters
177
Ok, if everything is configured correctly we can test the oscam installation
178
179 23 ruud -
<pre>
180 1 William Peters
/opt/oscam/oscam.bin -c /opt/oscam/etc/& touch /opt/oscam/oscam.log ; tail -f /opt/oscam/oscam.log ; killall oscam.bin
181 23 ruud -
</pre>
182 2 William Peters
183
this should create some output like this
184
185 23 ruud -
<pre>
186 2 William Peters
-------------------------------------------------------------------------------
187 14 William Peters
>> OSCam <<  cardserver started at Thu Oct 28 11:06:01 2010
188 2 William Peters
-------------------------------------------------------------------------------
189 14 William Peters
2010/10/28 11:06:01 B73DF6C0 s version=1.00-unstable_svn, build #, system=i686-pc-linux, nice=-1
190
2010/10/28 11:06:01 B73DF6C0 s client max. idle=120 sec, debug level=0
191
2010/10/28 11:06:01 B73DF6C0 s max. logsize=10 Kb
192
2010/10/28 11:06:01 B73DF6C0 s client timeout=2000 ms, fallback timeout=1500 ms, cache delay=0 ms
193
2010/10/28 11:06:01 B73DF6C0 s auth size=4788
194
2010/10/28 11:06:01 B73DF6C0 s Cannot open file "/opt/oscam/etc//oscam.services" (errno=2)
195
2010/10/28 11:06:01 B73DF6C0 s userdb reloaded: 0 accounts freed, 2 accounts loaded, 0 expired, 0 disabled
196
2010/10/28 11:06:01 B73DF6C0 s signal handling initialized (type=sysv)
197
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.srvid" (err=2), no service-id's loaded
198
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.tiers" (err=2), no tier-id's loaded
199
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.provid" (err=2), no provids's loaded
200
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.ird" (errno=2) irdeto guessing not loaded
201
2010/10/28 11:06:01 B73DF6C0 s monitor: initialized (fd=7, port=988)
202
2010/10/28 11:06:01 B73DF6C0 s camd33: disabled
203
2010/10/28 11:06:01 B73DF6C0 s camd35: disabled
204
2010/10/28 11:06:01 B73DF6C0 s cs378x: disabled
205
2010/10/28 11:06:01 B73DF6C0 s newcamd: initialized (fd=8, port=15050, crypted)
206
2010/10/28 11:06:01 B73DF6C0 s CAID: 0604
207
2010/10/28 11:06:01 B73DF6C0 s provid #0: 000000
208
2010/10/28 11:06:01 B73DF6C0 s cccam: disabled
209
2010/10/28 11:06:01 B73DF6C0 s radegast: disabled
210
2010/10/28 11:06:01 B73DF6C0 s http thread started
211
2010/10/28 11:06:01 B73DF6C0 s creating thread for device /dev/ttyUSB0 slot 0
212
2010/10/28 11:06:01 B73DF6C0 s waiting for local card init
213
2010/10/28 11:06:01 B7375280 r reader thread started (thread=B7375280, device=/dev/ttyUSB0, detect=cd, mhz=600, cardmhz=600)
214
2010/10/28 11:06:01 B76EA280 h HTTP Server listening on port 15080
215
2010/10/28 11:06:04 B7375280 r card detected
216
2010/10/28 11:06:08 B7375280 r ATR: 3B 9F 21 0E 49 52 44 45 54 4F 20 41 43 53 20 56 35 2E 37 9A
217
2010/10/28 11:06:09 B7375280 r Maximum frequency for this card is formally 6 Mhz, clocking it to 6.00 Mhz
218
2010/10/28 11:06:10 B7375280 r detect irdeto card
219
2010/10/28 11:06:10 B7375280 r caid: 0604, acs: 6.08, country code: NLD
220
2010/10/28 11:06:10 B7375280 r providers: 4, ascii serial: xxxxxxxxxxx, hex serial: XXXXXX, hex base: XX
221
2010/10/28 11:06:13 B7375280 r active providers: 4 (xxxxxx,xxxxxx,xxxxxx,xxxxxx)
222
2010/10/28 11:06:13 B7375280 r found cardsystem
223
2010/10/28 11:06:14 B7375280 r entitlements for provider: 1, id: XXXXXX
224
2010/10/28 11:06:14 B7375280 r chid: 0001, date: 2004/08/16 - 2004/09/15
225
2010/10/28 11:06:14 B7375280 r chid: 000B, date: 2004/08/16 - 2004/09/15
226
2010/10/28 11:06:14 B7375280 r chid: FFE0, date: 2004/08/16 - 2004/08/20
227
2010/10/28 11:06:14 B7375280 r chid: 0384, date: 2004/08/16 - 2004/09/15
228
2010/10/28 11:06:14 B7375280 r chid: 000D, date: 2004/08/16 - 2004/09/15
229
2010/10/28 11:06:19 B7375280 r [irdeto-reader] ready for requests
230
2010/10/28 11:06:19 B73DF6C0 s init for all local cards done
231
2010/10/28 11:06:19 B73DF6C0 s anti cascading disabled
232
2010/10/28 11:06:19 B736E280 c client connected to 15050 port
233
2010/10/28 11:06:19 B7367280 c client connected to 15050 port
234
2010/10/28 11:06:19 B7367280 c Connection closed to client
235
2010/10/28 11:06:19 B736E280 c Connection closed to client
236
2010/10/28 11:06:19 B7367280 c thread B7367280 ended!
237
2010/10/28 11:06:19 B736E280 c thread B736E280 ended!
238 23 ruud -
</pre>
239 2 William Peters
240 1 William Peters
Oscam is now running on serverip:15050.
241
Open your tvheadend web interface.
242 24 William Peters
Go to Configuration and click Code Word Client
243 1 William Peters
Click Add Entry
244
Doubleclick 'hostname' type your server ip or hostname that is runnin oscam. 
245
Doubleclick 'port' type the port number (if you made no changes to config files it should be 15050).
246
Doubleclick 'username' type the username as configured in oscam.user.
247 2 William Peters
Doubleclick 'password' type the password as configured in oscam.user.
248 11 William Peters
Doubleclick 'DES key' here you can insert your DES key. If you haven't changed it in oscam.conf (you should!) then this should be: 01:02:03:04:05:06:07:08:09:10:11:12:13:14
249 26 William Peters
Check 'Update Card'
250 2 William Peters
Now check Enabled and click 'Save Changes'
251 16 William Peters
252 5 William Peters
When you click Save Changes you will see something like this in the system logs
253
254 23 ruud -
<pre>
255 5 William Peters
Mar 24 20:55:38 cwc: 10.2.0.2: Connected as user 0x0x to a Irdeto-card [0x0604 : xx.xx.xx.xx.xx.xx.xx.xx] with 5 providers
256
Mar 24 20:55:38 cwc: 10.2.0.2: irdeto card
257
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #1: 0x000000 xx.xx.xx.xx.xx.xx.xx.xx
258
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #2: 0x000001 xx.xx.xx.xx.xx.xx.xx.xx
259 2 William Peters
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #3: 0x000002 xx.xx.xx.xx.xx.xx.xx.xx
260
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #4: 0x000003 xx.xx.xx.xx.xx.xx.xx.xx
261
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #5: 0x000004 xx.xx.xx.xx.xx.xx.xx.xx
262
Mar 24 20:55:38 cwc: 10.2.0.2: Will forward EMMs
263 23 ruud -
</pre>
264 7 Lars Op den Kamp -
265 1 William Peters
Ok tvheadend is now connected to oscam and is able to descramble channels that your card gives you access to.
266 26 William Peters
Now to kill oscam press ctrl+c in the console.
267 1 William Peters
268 25 William Peters
Now you need to change the owner and group of /opt/oscam to oscam (because you should run oscam as a unprivileged user)
269 1 William Peters
270 25 William Peters
<pre>
271
chown -R oscam:oscam /opt/oscam
272
</pre>
273 2 William Peters
274 23 ruud -
h2. For Gentoo users i have an init script
275
276
277 2 William Peters
nano -w /etc/init.d/oscam
278 23 ruud -
<pre>
279 15 William Peters
#!/sbin/runscript
280 2 William Peters
# Copyright 1999-2010 Gentoo Foundation
281
# Distributed under the terms of the GNU General Public License v2
282
# $Header:
283
284 14 William Peters
depend() {
285 2 William Peters
        use net
286
}
287
288
start() {
289 14 William Peters
        ebegin "Starting oscam"
290
        start-stop-daemon \
291
                --start \
292
                --user $OSCAMUSER \
293
                --name $OSCAMNAME \
294 2 William Peters
                --exec $OSCAMBIN -- $OSCAMOPTS
295
        eend $?
296
}
297
298
stop() {
299 1 William Peters
        ebegin "Stopping oscam"
300 2 William Peters
        start-stop-daemon --stop --signal 2 --name $OSCAMNAME
301
        eend $?
302
}
303 23 ruud -
</pre>
304 2 William Peters
305
nano -w /etc/conf.d/oscam
306 23 ruud -
<pre>
307 1 William Peters
# /etc/conf.d/oscam: config file for /etc/init.d/oscam
308 14 William Peters
309
OSCAMOPTS="-b -c /opt/oscam/etc/"
310 19 William Peters
OSCAMUSER="oscam"
311 14 William Peters
OSCAMNAME="oscam.bin"
312
OSCAMBIN="/opt/oscam/${OSCAMNAME}"
313 23 ruud -
</pre>