catalinii / minisatip

minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
https://minisatip.org
324 stars 78 forks source link

Services pinning to specific CAM or do-not-descramble option #1091

Closed Delitants closed 1 week ago

Delitants commented 1 year ago

I think this feature was requested earlier, but I can't find a related ticket. This is essential, please make possible pinning services to a specific CAM and do-not-descramble option per service (similar to existing flag -E but I want to set manually what service to pass though).

Situation is next. Tuner TBS 6590 with dual CI slot, TP has 3 services, one SHOULD be descrambled by CAM-1, second with CAM-2 and not otherwise, and third must be passed AS IS without even trying to process it, because it will be descrambled by softcam in different software.

Note: flag -E does not work in this scenario, because it still tries to send channel to an already busy CAM, it passes through only if cam refuses to descramble, but this is not the case.

Jalle19 commented 1 year ago

Pinning services to a specific CAM is supported, but "ignoring" a service is not.

Delitants commented 1 year ago

Pinning services to a specific CAM is supported, but "ignoring" a service is not.

How do you pin them without physically using secondary tuner of the card?

Jalle19 commented 1 year ago

I'm not sure how the TBS 6590 works, it could be that the CAM assignment cannot be controlled if the card doesn't work as "standalone" CI cards, like the Digital Devices models.

catalinii commented 1 year ago

CAM assignment works at the moment just for standalone CI cards (tbs 6900)

Yuri666 commented 1 year ago

Pinning services to a specific CAM is supported, but "ignoring" a service is not.

How do you pin them without physically using secondary tuner of the card?

No way. In the tbs6590 CI are physically connected to the tuner and accordingly if you wish to use second CI you must use a second tuner.

Delitants commented 1 year ago

Pinning services to a specific CAM is supported, but "ignoring" a service is not.

How do you pin them without physically using secondary tuner of the card?

No way. In the tbs6590 CI are physically connected to the tuner and accordingly if you wish to use second CI you must use a second tuner.

Okay, I'm more interested in skipping services for descrambling in external software, second part of this ticket.

Yuri666 commented 1 year ago

Theoretically it can be done - just do not send CA_PMT when switching to this channel. I don't know how difficult it is to implement. It's easier to use a dvb card without CI for these purposes.

Jalle19 commented 1 year ago

I think "service skipping" could be reasonably implemented for standalone cards (using the same ddci.conf file), but for "bonded" CI slots it's a bit clumsy like Yuri explained.

Yuri666 commented 1 year ago

for standalone cards it's already implemented in ddci.conf

Delitants commented 1 year ago

I think "service skipping" could be reasonably implemented for standalone cards (using the same ddci.conf file), but for "bonded" CI slots it's a bit clumsy like Yuri explained.

Why is it clumsy? -E switch does pass undecrypted service through when CAM refuses to decode it due to lack of entitlements. Coming from that, it should be possibly to just send raw stream without bothering CAM. Basically I just want to tap the same transponder and save on physical tuners.

catalinii commented 1 year ago

ituation is next. Tuner TBS 6590 with dual CI slot, TP has 3 services, one SHOULD be descrambled by CAM-1, second with CAM-2 and not otherwise, and third must be passed AS IS without even trying to process it, because it will be descrambled by softcam in different software

In this hardware CAM1 is connected to Adapter1 on the device. In your example, if the TP is tuned on adapter 1, CAM-1 can be set to decrypt only service 1. Service cannot be descrambled with CAM2 because the stream from adapter 1 does not pass thru CAM2. If you use -c X:1 third stream wont attempt to use CAM1 X here is the number of the first adapter from the board (0 if no other cards are present)

Delitants commented 1 year ago

In this hardware CAM1 is connected to Adapter1 on the device. In your example, if the TP is tuned on adapter 1, CAM-1 can be set to decrypt only service 1. Service cannot be descrambled with CAM2 because the stream from adapter 1 does not pass thru CAM2. If you use -c X:1 third stream wont attempt to use CAM1 X here is the number of the first adapter from the board (0 if no other cards are present)

I've tried that already, -c 1:1 -E, it does not pass through, it gets stuck in loop attempting to use CAM but throwing an error that no free PID slots available.

catalinii commented 1 year ago

Can u upload logs?

./minisatip -f -l http

Delitants commented 1 year ago

Can u upload logs?

./minisatip -f -l http

Here you go. When I've started a second encrypted stream, which needs to be passed through, it loops with these messages and receiver does not get a stream. ExecStart=/root/minisatip-1.2.102/minisatip -I minisatipsecondary -O -x 8082 -y 555 -D 2 -e 2 -c 2:1 -j 2:15-1470 -M :5.0-5.0 -t -l ca,http -Z :0 -F /var/log/minisatip2.log

[27/03 00:00:02.099 AD2]: No free slots to add PMT 3 to CA 2 [27/03 00:00:02.140 AD2]: Sending PMT 3 to all CAs: ad_ca_mask 1, pmt_ca_mask 0, disabled_ca_mask 0 [27/03 00:00:02.140 AD2]: CAID 1856 and mask FFFF matched PMT 3 [27/03 00:00:02.140 AD2]: CA 2 all channels used 1, multiple allowed 0

minisatip2.log

catalinii commented 1 year ago

This just means that the second encrypted stream will not be using CA2 (because one is already used). So at that point using -E should allow the stream to pass to the client

Delitants commented 1 year ago

This just means that the second encrypted stream will not be using CA2 (because one is already used). So at that point using -E should allow the stream to pass to the client

Well, it should but it does not send anything but some ~80 kbps on the output.

catalinii commented 1 year ago

Do you have rights to decrypt the second channel with the CAM?

Delitants commented 1 year ago

Do you have rights to decrypt the second channel with the CAM?

yes

catalinii commented 1 year ago

Can you add -l pmt and upload the (entire) log for the same repro?

Delitants commented 1 year ago

Can you add -l pmt and upload the (entire) log for the same repro?

minisatip2.log

Delitants commented 1 year ago

Here, I switched the channels around by tuning them in opposite order. minisatip2.log

-O -x 8082 -y 555 -D 2 -e 2 -c 2:1 -j 2:15-1470 -M :5.0-5.0 -t -E -l ca,http,pmt -Z :0 -F /var/log/minisatip2.log

Output of a skipped channel is 21Kb, only data and no content: Screenshot 2023-03-26 at 7 03 17 PM

Yuri666 commented 1 year ago

If you use -c X:1 third stream wont attempt to use CAM1 X here is the number of the first adapter from the board (0 if no other cards are present)

For me, it just side effect. If third stream starts first it will be decoded by CAM. I suggest add ca.conf Then to read ca.conf and add to dvbca_process_pmt() if (sid==(sid from ca.conf)) return TABLES_RESULT_ERROR_NORETRY; So, this SID will not be decoded by any CAM. By other side one more conf file...

Delitants commented 1 year ago

If you use -c X:1 third stream wont attempt to use CAM1 X here is the number of the first adapter from the board (0 if no other cards are present)

For me, it just side effect. If third stream starts first it will be decoded by CAM. I suggest add ca.conf Then to read ca.conf and add to dvbca_process_pmt() if (sid==(sid from ca.conf)) return TABLES_RESULT_ERROR_NORETRY; So, this SID will not be decoded by any CAM. By other side one more conf file...

Some sort of config with list of services to be passed untouched would be great. But I can’t code that myself.

catalinii commented 1 year ago

my bad, can you use "-v pmt" instrd of "-l pmt". I am looking for this message: https://github.com/catalinii/minisatip/blob/master/src/pmt.c#L1158

Delitants commented 1 year ago

my bad, can you use "-v pmt" instrd of "-l pmt". I am looking for this message: https://github.com/catalinii/minisatip/blob/master/src/pmt.c#L1158

Enabled first channel - it went decoding fine, then enabled second channel to get passed through (which does not). minisatip2.log

Delitants commented 1 year ago

Bump

Jalle19 commented 1 year ago

@Delitants assuming the SID you want to omit from all your CAMs is 7000, can you add this to your ddci.conf and test https://github.com/Jalle19/minisatip/commit/6a525e13941e22048d278c630854d00ebb93c7cf ?

7000: # not assigned anywhere

You should see something like find_ddci_for_pmt: no suitable DDCI found for PMT 4 (sid 7000): not mapped to any DDCI device in ddci.conf in your log when you try to play that service.

Note that this only works for standalone CI adapters right now, not e.g. Enigma.

Jalle19 commented 1 week ago

@catalinii https://github.com/catalinii/minisatip/blob/b2c865a6b283176b61a14bd82ca25c1144f1d976/src/ddci.c#L1419 could this be why -E doesn't seem to work properly with standalone CI adapters?

Delitants commented 1 week ago

@Delitants assuming the SID you want to omit from all your CAMs is 7000, can you add this to your ddci.conf and test Jalle19@6a525e1 ?

7000: # not assigned anywhere

You should see something like find_ddci_for_pmt: no suitable DDCI found for PMT 4 (sid 7000): not mapped to any DDCI device in ddci.conf in your log when you try to play that service.

Note that this only works for standalone CI adapters right now, not e.g. Enigma.

It's a bonded CI slot, TBS 6590. None of those ddci.conf manipulations give desired effect of simply skipping one channel passing it through.

Jalle19 commented 1 week ago

Right, my PR will not help your situation then.

catalinii commented 1 week ago

@catalinii

https://github.com/catalinii/minisatip/blob/b2c865a6b283176b61a14bd82ca25c1144f1d976/src/ddci.c#L1419

could this be why -E doesn't seem to work properly with standalone CI adapters?

This line just allows passing encrypted packets from the original ddci adapter to the original one (in case oscam wants to decrypt them).

Jalle19 commented 1 week ago

Closing this, is now implemented for standalone CI adapters