Skip to contentSkip to conversation

Ngene cam device name

PATCH Issa Gorissen 5 participants 14 messages May 4, 2011 – May 9, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

From: Andreas Oberritter <[email protected]>

Quoted 13 lines

Also, there's still no mapping between ca and caio devices. Imagine a built-in descrambler ca0 and two CI slots ca1 and ca2.

ca0 won't get a caio device, at least for now. ca1 and ca2 might or might not have a caio device.

If there is caio0, how am I supposed to know that it's related to ca1 or ca2 (or ca0, if someone implements a caio device to bypass the software demux to use a built-in descrambler)? You must not assume that there are either none or two (or three) caio interfaces. You need to be able to detect (or set up) the connection between the interfaces. Otherwise this "API" will be a mess.

Quoted 2 lines

Regards,
Andreas

To my understanding, in such a described case,

- ca0 would be reached from /dev/dvb/adapter0/ca0
- ca[12], depending on if they are connected to the same physical adapter (PCI, USB, ...), would be reached from /dev/dvb/adapter1/ca[12] or /dev/dvb/adapter1/ca1 and /dev/dvb/adapter2/ca2 and there respective caio devices.

- If the 3 ca devices are on the same adapter, then the driver writer should take care of the order of the mapping so that ca1 always map caio1 and ca2/caio2, ...; and if this is not feasable, then the driver writer should span the ca/caio devices on different /dev/dvb/adapter folders.

#1 lore raw
Quoted 18 lines · Issa Gorissen

From: Andreas Oberritter <[email protected]>

Quoted 13 lines

Also, there's still no mapping between ca and caio devices. Imagine a built-in descrambler ca0 and two CI slots ca1 and ca2.

ca0 won't get a caio device, at least for now. ca1 and ca2 might or might not have a caio device.

If there is caio0, how am I supposed to know that it's related to ca1 or ca2 (or ca0, if someone implements a caio device to bypass the software demux to use a built-in descrambler)? You must not assume that there are either none or two (or three) caio interfaces. You need to be able to detect (or set up) the connection between the interfaces. Otherwise this "API" will be a mess.

Quoted 2 lines

Regards,
Andreas

Quoted 7 lines

To my understanding, in such a described case,

- ca0 would be reached from /dev/dvb/adapter0/ca0
- ca[12], depending on if they are connected to the same physical adapter (PCI, USB, ...), would be reached from /dev/dvb/adapter1/ca[12] or /dev/dvb/adapter1/ca1 and /dev/dvb/adapter2/ca2 and there respective caio devices.

Of course I'm referring to devices connected to the same physical adapter. Otherwise they would all be called ca0. Device enumeration always starts at 0, for each adapter. What you're describing just doesn't make sense.

Quoted 4 lines

- If the 3 ca devices are on the same adapter, then the driver writer should take care of the order of the mapping so that ca1 always map caio1 and ca2/caio2, ...; and if this is not feasable, then the driver writer should span the ca/caio devices on different /dev/dvb/adapter folders.

You can't create caio1 without creating caio0 first. Of course, you could require driver writers to register those ca devices first that have caio devices. But that conflicts with other policies the driver author might already have chosen, e.g. to map the ca (descrambler) device numbers to demux and dvr numbers, which seems way more intuitive to me, because demux hardware usually comes with built-in descramblers.

It's ugly to force random policies on drivers. Please create a proper interface instead!

Last but not least, using a different adapter number wouldn't fit either, because a DVB adapter is supposed to
- be one independent piece of hardware
- provide at least a frontend and a demux device

At least on embedded devices, it simply isn't feasible to copy a TS to userspace from a demux, just to copy it back to the kernel and again back to userspace through a caio device, when live streaming. But you may want to provide a way to use the caio device for offline-descrambling. Unless you want to force users to buy multiple modules and multiple subscriptions for a single receiver, which in turn would need multiple CI slots, you need a way to make sure caio can not be used during live streaming. If this dependency is between different adapters, then something is really, really wrong.

Why don't you just create a new device, e.g. ciX, deprecate the use of caX for CI devices, inherit CI-related existing ioctls from the CA API, translate the existing read and write funtions to ioctls and then use read and write for TS I/O? IIRC, Ralph suggested something similar. I'm pretty sure this can be done without too much code and in a backwards compatible way.

Regards,
Andreas

#2 lore raw
Quoted 10 lines · Andreas Oberritter
Quoted 5 lines

- ca0 would be reached from /dev/dvb/adapter0/ca0
- ca[12], depending on if they are connected to the same physical adapter (PCI, USB, ...), would be reached from /dev/dvb/adapter1/ca[12] or /dev/dvb/adapter1/ca1 and /dev/dvb/adapter2/ca2 and there respective caio devices.

Of course I'm referring to devices connected to the same physical adapter. Otherwise they would all be called ca0. Device enumeration always starts at 0, for each adapter. What you're describing just doesn't make sense.

Of course it does since it is not feasible to use the same adapter number even on the same card when it provides multi-standard frontends which share dvr and demux devices. E.g., frontend0 and frontend1 can belong to the same demod which can be DVB-C and -T (or other combinations, some demods can even do DVB-C/T/S2).

frontend0 and frontend1 could then be DVB-C/T of demod 0 frontend2 and frontend3 would be DVB-C/T of demod 1. frontend4 might be a DVB-S frontend of demod 2, frontend5 DVB-S of demod 3. How do I know then which frontends belong to the 4 demux/dvr devices?
Or is there a standard way this is supposed to be handled?

There are no mechanism to connect a frontend with specific dvr or demux devices in the current API. But you demand it for the caio device.

Quoted 11 lines
Quoted 4 lines

- If the 3 ca devices are on the same adapter, then the driver writer should take care of the order of the mapping so that ca1 always map caio1 and ca2/caio2, ...; and if this is not feasable, then the driver writer should span the ca/caio devices on different /dev/dvb/adapter folders.

You can't create caio1 without creating caio0 first. Of course, you could require driver writers to register those ca devices first that have caio devices. But that conflicts with other policies the driver author might already have chosen, e.g. to map the ca (descrambler) device numbers to demux and dvr numbers, which seems way more intuitive to me, because demux hardware usually comes with built-in descramblers.

A ca/caio pair is completely independent by design and should not get mixed with other devices.

Quoted 4 lines

It's ugly to force random policies on drivers. Please create a proper interface instead!

Then the whole API should first get proper interfaces. See above.

Quoted 4 lines

Last but not least, using a different adapter number wouldn't fit either, because a DVB adapter is supposed to
- be one independent piece of hardware
- provide at least a frontend and a demux device

If you only plug in CI adapter modules in the octopus cards there are no frontend and demux devices.
So, should we invent frontend and demux devices so that we are allowed to use the DVB API?
Or should we create a new independent API for this?
Even if we copy 99% of the existing ca API?

Quoted 3 lines

At least on embedded devices, it simply isn't feasible to copy a TS to userspace from a demux, just to copy it back to the kernel and again back to userspace through a caio device, when live streaming.

Then do not use it on embedded devices.
But this is how this hardware works and APIs will not change the hardware.

Quoted 7 lines

But you
may want to provide a way to use the caio device for offline-descrambling. Unless you want to force users to buy multiple modules and multiple subscriptions for a single receiver, which in turn would need multiple CI slots, you need a way to make sure caio can not be used during live streaming. If this dependency is between different adapters, then something is really, really wrong.

What dependency are you talking about?

Quoted 7 lines

Why don't you just create a new device, e.g. ciX, deprecate the use of caX for CI devices, inherit CI-related existing ioctls from the CA API, translate the existing read and write funtions to ioctls and then use read and write for TS I/O? IIRC, Ralph suggested something similar. I'm pretty sure this can be done without too much code and in a backwards compatible way.

This would require changing all en50221 related user space code. I only mentioned it would have been nice to have it this way from the beginning. Now it would be too late since one usually gets loud screaming from everywhere if user space API changes
(not extensions) are even thought about.

-Ralph

#3 lore raw
Quoted 12 lines · Ralph Metzler
Quoted 10 lines · Andreas Oberritter
Quoted 5 lines

- ca0 would be reached from /dev/dvb/adapter0/ca0
- ca[12], depending on if they are connected to the same physical adapter (PCI, USB, ...), would be reached from /dev/dvb/adapter1/ca[12] or /dev/dvb/adapter1/ca1 and /dev/dvb/adapter2/ca2 and there respective caio devices.

Of course I'm referring to devices connected to the same physical adapter. Otherwise they would all be called ca0. Device enumeration always starts at 0, for each adapter. What you're describing just doesn't make sense.

Quoted 5 lines

Of course it does since it is not feasible to use the same adapter number even on the same card when it provides multi-standard frontends which share dvr and demux devices. E.g., frontend0 and frontend1 can belong to the same demod which can be DVB-C and -T (or other combinations, some demods can even do DVB-C/T/S2).

There's absolutely no need to have more than one frontend device per demod. Just add two commands, one to query the possible delivery systems and one to switch the system. Why would you need more than one device node at all, if you can only use one delivery system at a time?

Quoted 5 lines

frontend0 and frontend1 could then be DVB-C/T of demod 0 frontend2 and frontend3 would be DVB-C/T of demod 1. frontend4 might be a DVB-S frontend of demod 2, frontend5 DVB-S of demod 3. How do I know then which frontends belong to the 4 demux/dvr devices?

By configuration.

Quoted 1 line

Or is there a standard way this is supposed to be handled?

Yes. Since ages. The ioctl is called DMX_SET_SOURCE.

Quoted 2 lines

There are no mechanism to connect a frontend with specific dvr or demux devices in the current API. But you demand it for the caio device.

See above.

Quoted 12 lines
Quoted 11 lines
Quoted 4 lines

- If the 3 ca devices are on the same adapter, then the driver writer should take care of the order of the mapping so that ca1 always map caio1 and ca2/caio2, ...; and if this is not feasable, then the driver writer should span the ca/caio devices on different /dev/dvb/adapter folders.

You can't create caio1 without creating caio0 first. Of course, you could require driver writers to register those ca devices first that have caio devices. But that conflicts with other policies the driver author might already have chosen, e.g. to map the ca (descrambler) device numbers to demux and dvr numbers, which seems way more intuitive to me, because demux hardware usually comes with built-in descramblers.

Quoted 2 lines

A ca/caio pair is completely independent by design and should not get mixed with other devices.

I guess you're right, but I'm questioning your design.

Quoted 6 lines
Quoted 4 lines

It's ugly to force random policies on drivers. Please create a proper interface instead!

Then the whole API should first get proper interfaces. See above.

Already done. See above.

Quoted 9 lines
Quoted 4 lines

Last but not least, using a different adapter number wouldn't fit either, because a DVB adapter is supposed to
- be one independent piece of hardware
- provide at least a frontend and a demux device

If you only plug in CI adapter modules in the octopus cards there are no frontend and demux devices.
So, should we invent frontend and demux devices so that we are allowed to use the DVB API?

Of course, you shouldn't invent fake frontends. But, if you decide to plug a frontend into your octopus card later on, then the frontend device should appear under the same adapter number. Right?

If the demux is hardware-based, then of course the device should be present, even if no frontend is connected. If it's software-based, it's probably a matter of choice.

Quoted 2 lines

Or should we create a new independent API for this? Even if we copy 99% of the existing ca API?

I already proposed an API that would integrate nicely into the status quo.

Quoted 6 lines
Quoted 3 lines

At least on embedded devices, it simply isn't feasible to copy a TS to userspace from a demux, just to copy it back to the kernel and again back to userspace through a caio device, when live streaming.

Then do not use it on embedded devices.
But this is how this hardware works and APIs will not change the hardware.

In a similar way, I could propose to not use vanilla kernels, if you don't want to come up with a good API.

Anyway, my point was that there must be some kind of resource management between the data path used in live streaming applications (i.e. in kernel space) and the data path used for offline-descrambling (i.e. your caio device through userspace). How do you intend to implement resource management between multiple adapters? If a device appears to be independent of another device, because it has a different adapter number, then this device must not interfere with devices of other adapters.

Maybe the Ngene CAM really is independent and can't be used without all the copying, but we're talking about the introduction of a new API here, and I hope that this API won't just work with this one device.

Quoted 9 lines
Quoted 7 lines

But you
may want to provide a way to use the caio device for offline-descrambling. Unless you want to force users to buy multiple modules and multiple subscriptions for a single receiver, which in turn would need multiple CI slots, you need a way to make sure caio can not be used during live streaming. If this dependency is between different adapters, then something is really, really wrong.

What dependency are you talking about?

Locking between adapters. See above.

Quoted 9 lines
Quoted 7 lines

Why don't you just create a new device, e.g. ciX, deprecate the use of caX for CI devices, inherit CI-related existing ioctls from the CA API, translate the existing read and write funtions to ioctls and then use read and write for TS I/O? IIRC, Ralph suggested something similar. I'm pretty sure this can be done without too much code and in a backwards compatible way.

Quoted 5 lines

This would require changing all en50221 related user space code. I only mentioned it would have been nice to have it this way from the beginning. Now it would be too late since one usually gets loud screaming from everywhere if user space API changes
(not extensions) are even thought about.

Read again: backwards compatible. That implies no change to existing APIs.

Regards,
Andreas

#4 lore raw
Quoted 10 lines · Andreas Oberritter
Quoted 5 lines

Of course it does since it is not feasible to use the same adapter number even on the same card when it provides multi-standard frontends which share dvr and demux devices. E.g., frontend0 and frontend1 can belong to the same demod which can be DVB-C and -T (or other combinations, some demods can even do DVB-C/T/S2).

There's absolutely no need to have more than one frontend device per demod. Just add two commands, one to query the possible delivery systems and one to switch the system. Why would you need more than one device node at all, if you can only use one delivery system at a time?

Maybe because there is no proper documentation for this.

Quoted 3 lines
Quoted 1 line

Or is there a standard way this is supposed to be handled?

Yes. Since ages. The ioctl is called DMX_SET_SOURCE.

This does make no sense regarding my question.

Quoted 4 lines
Quoted 2 lines

There are no mechanism to connect a frontend with specific dvr or demux devices in the current API. But you demand it for the caio device.

See above.

Ok, wrong formulation. There is no API to indicate which can connect to which.

Quoted 4 lines
Quoted 2 lines

A ca/caio pair is completely independent by design and should not get mixed with other devices.

I guess you're right, but I'm questioning your design.

How else can an independent CI interface be designed? And this is how the hardware is. I cannot change this in software.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

It's ugly to force random policies on drivers. Please create a proper interface instead!

Then the whole API should first get proper interfaces. See above.

Already done. See above.

And no proper documentation.

Quoted 3 lines

Of course, you shouldn't invent fake frontends. But, if you decide to plug a frontend into your octopus card later on, then the frontend device should appear under the same adapter number. Right?

No, it does not right now.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

At least on embedded devices, it simply isn't feasible to copy a TS to userspace from a demux, just to copy it back to the kernel and again back to userspace through a caio device, when live streaming.

Then do not use it on embedded devices.
But this is how this hardware works and APIs will not change the hardware.

In a similar way, I could propose to not use vanilla kernels, if you don't want to come up with a good API.

Why? The driver works fine on top of vanilla kernels.

I do not really care if the driver itself gets into the kernel anymore.

-Ralph

#5 lore raw
In reply to Andreas Oberritter
Quoted 4 lines
Quoted 2 lines

Or is there a standard way this is supposed to be handled?

Yes. Since ages. The ioctl is called DMX_SET_SOURCE.

DMX_SET_SOURCE seems to not be implemented anywhere, all it does is return EINVAL. I also fail to find any useful documentation about what it is supposed to do.

Quoted 4 lines
Quoted 3 lines

There are no mechanism to connect a frontend with specific dvr or demux devices in the current API. But you demand it for the caio device.

I think there is currently no useful API to connect devices. Every few months there comes a new device which deprecates how I enumerate devices and determine types of FE's.

The most useful way to query devices seems to be using HAL, and I think this is the correct way in Linux, but DVB-API may be lacking with providing the necessary information. Maybe this is the direction we should consider? Device names under /dev seem to be irrelevant nowadays.

Best regards,
Martin Vidovic

#6 lore raw
Quoted 8 lines · Martin Vidovic
Quoted 4 lines
Quoted 2 lines

Or is there a standard way this is supposed to be handled?

Yes. Since ages. The ioctl is called DMX_SET_SOURCE.

DMX_SET_SOURCE seems to not be implemented anywhere, all it does is return EINVAL. I also fail to find any useful documentation about what it is supposed to do.

It is supposed to connect the TS output of frontend X to the TS input of demux Y. Whether you need to manually connect anything depends on your application and hardware environment. It's not required at all when using the software demux, which is what almost all in-tree drivers do.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

There are no mechanism to connect a frontend with specific dvr or demux devices in the current API. But you demand it for the caio device.

I think there is currently no useful API to connect devices. Every few months there comes a new device which deprecates how I enumerate devices and determine types of FE's.

Can you describe the most common problems? What do you mean by connecting?

Quoted 4 lines

The most useful way to query devices seems to be using HAL, and I think this is the correct way in Linux, but DVB-API may be lacking with providing the necessary information. Maybe this is the direction we should consider? Device names under /dev seem to be irrelevant nowadays.

I think in the long run we should look closely at how V4L2 is solving similar problems.

Regards,
Andreas

#7 lore raw

Hi,

Broadly speaking, I could put issues discussed in this thread into following categories:

- How devices are named;
- How devices are used;
- How devices relate to one another;
- How devices are enumerated;
- How devices are described;

Mostly we discuss category 1 and 2 with relation to nGENE CI, but sometimes we leap to other categories as well.

Quoted 7 lines · Andreas Oberritter
Quoted 4 lines · Martin Vidovic

I think there is currently no useful API to connect devices. Every few months there comes a new device which deprecates how I enumerate devices and determine types of FE's.

Can you describe the most common problems? What do you mean by connecting?

What I mean by connecting devices falls into last 3 categories (above). I brought this up because I don't believe this is the actual problem we need to solve here since it's not nGENE specific.

Some examples of problems in categories 3-5:

a) Plug two TerraTec Cinergy T RC MKII and try to distinguish between them.

b) Take a Hybrid terrestrial TV tuner. V4L and DVB APIs (may) use shared resources, how does one find this out?

c.1) How does one know which frontend device can be used with which demux device?

c.2) Which CA device can be used with which frontend device?

d) How does one list all supported delivery systems for a device (FE_GET_INFO is not general, and DTV_DELIVERY_SYSTEM can't be used to query available delivery systems).

e) the list could be extended...

These problems are mostly not fatal, they have workarounds. Some of them require device/driver specific knowledge.

Quoted 7 lines
Quoted 4 lines

The most useful way to query devices seems to be using HAL, and I think this is the correct way in Linux, but DVB-API may be lacking with providing the necessary information. Maybe this is the direction we should consider? Device names under /dev seem to be irrelevant nowadays.

I think in the long run we should look closely at how V4L2 is solving similar problems.

The best would be to create independent adapters for each independent CA device (ca0/caio0 pair) - they are independent after all (physically and in the way they're used).

What I understand you would like to see, is the ability to do direct transfers between independent devices or parts of devices. Is this correct?

Best regards,
Martin Vidovic

#8 lore raw
Quoted 24 lines · Martin Vidovic

Hi,

Broadly speaking, I could put issues discussed in this thread into following categories:

- How devices are named;
- How devices are used;
- How devices relate to one another;
- How devices are enumerated;
- How devices are described;

Mostly we discuss category 1 and 2 with relation to nGENE CI, but sometimes we leap to other categories as well.

Quoted 8 lines · Andreas Oberritter
Quoted 4 lines · Martin Vidovic

I think there is currently no useful API to connect devices. Every few months there comes a new device which deprecates how I enumerate devices and determine types of FE's.

Can you describe the most common problems? What do you mean by connecting?

Quoted 7 lines

What I mean by connecting devices falls into last 3 categories (above). I brought this up because I don't believe this is the actual problem we need to solve here since it's not nGENE specific.

Some examples of problems in categories 3-5:

a) Plug two TerraTec Cinergy T RC MKII and try to distinguish between them.

I don't have any USB or PCI hardware within reach, but if udev is able to create the devices, there should be some way to connect adapters to the bus id through sysfs. I guess that's how it's done with other subsystems, too.

If this information is missing from sysfs, would adding it help to solve this problem?

Quoted 2 lines

b) Take a Hybrid terrestrial TV tuner. V4L and DVB APIs (may) use shared resources, how does one find this out?

That's a good question and the same question must be asked for video and audio decoders, which can be controlled by V4L, DVB, ALSA etc.

How does V4L integrate with ALSA?

Quoted 2 lines

c.1) How does one know which frontend device can be used with which demux device?

I'd say by default (i.e. without DMX_SET_SOURCE, whether implemented or not) frontendX is connected to demuxX on the same adapter. You have probably faced other situations. Can you describe any?

Quoted 1 line

c.2) Which CA device can be used with which frontend device?

For built-in descramblers, I'd say each caX is always connected to (built into) demuxX.

For CI slots, this might be different and on the Dreambox we're using a proprietary API to connect CI slots between frontends and demuxes.

Is there any in-tree supported hardware, that has more than one CI slot *and* more than one frontend (usable at the same time)?

I agree that an API would be nice to query and set up such things, but I had expected that the need for it was rather low for non-embedded systems.

Quoted 3 lines

d) How does one list all supported delivery systems for a device (FE_GET_INFO is not general, and DTV_DELIVERY_SYSTEM can't be used to query available delivery systems).

How about this proposal?

http://www.mail-archive.com/[email protected]/msg31124.html

Quoted 10 lines

e) the list could be extended...

These problems are mostly not fatal, they have workarounds. Some of them require device/driver specific knowledge.

Quoted 5 lines
Quoted 4 lines

The most useful way to query devices seems to be using HAL, and I think this is the correct way in Linux, but DVB-API may be lacking with providing the necessary information. Maybe this is the direction we should consider? Device names under /dev seem to be irrelevant nowadays.

Quoted 6 lines
Quoted 2 lines

I think in the long run we should look closely at how V4L2 is solving similar problems.

The best would be to create independent adapters for each independent CA device (ca0/caio0 pair) - they are independent after all (physically and in the way they're used).

Physically, it's a general purpose TS I/O interface of the nGene chipset. It just happens to be connected to a CI slot. On another board, it might be connected to a modulator or just to some kind of socket.

If the next version gets a connector for two switchable CI modules, then the physical independence is gone. You'd have two ca nodes but only one caio node. Or two caio nodes, that can't be used concurrently.

Maybe the next version gets the ability to directly connect the TS input from the frontend to the TS output to the CI slot to save copying around the data, by using some kind of pin mux. Not physically independent either.

It just looks physically independent in the one configuration implemented now.

Quoted 2 lines

What I understand you would like to see, is the ability to do direct transfers between independent devices or parts of devices. Is this correct?

Yes, between parts of devices, where the CI input can be fed by both the TS output of the frontend and from memory (e.g. userspace).

Although it would be nice to have DMA transfers between independent devices, that's a different topic.

Regards,
Andreas

#9 lore raw

Hi,

Quoted 12 lines · Andreas Oberritter
Quoted 11 lines · Martin Vidovic

Hi,

Broadly speaking, I could put issues discussed in this thread into following categories:

- How devices are named;
- How devices are used;
- How devices relate to one another;
- How devices are enumerated;
- How devices are described;

Quoted 3 lines
Quoted 3 lines

Mostly we discuss category 1 and 2 with relation to nGENE CI, but sometimes we leap to other categories as well.

I must say I really like this discussion so far. But for me to keep
focus: Can someone list different options for naming/using/relating/enumerating/describing devices in relation to (multiple?ngene?) CI's.
Or does that information already exist?

Walter

#10 lore raw
In reply to Andreas Oberritter
Quoted 4 lines · Andreas Oberritter
Quoted 2 lines · Martin Vidovic

a) Plug two TerraTec Cinergy T RC MKII and try to distinguish between them.

Quoted 8 lines

I don't have any USB or PCI hardware within reach, but if udev is able to create the devices, there should be some way to connect adapters to the bus id through sysfs. I guess that's how it's done with other subsystems, too.

If this information is missing from sysfs, would adding it help to solve this problem?

Binding to bus id is not a problem. However, especially for USB devices, it may be useful to have adapter MAC address in sysfs.

Quoted 8 lines
Quoted 2 lines

b) Take a Hybrid terrestrial TV tuner. V4L and DVB APIs (may) use shared resources, how does one find this out?

That's a good question and the same question must be asked for video and audio decoders, which can be controlled by V4L, DVB, ALSA etc.

How does V4L integrate with ALSA?

I don't know.

Quoted 7 lines
Quoted 2 lines

c.1) How does one know which frontend device can be used with which demux device?

I'd say by default (i.e. without DMX_SET_SOURCE, whether implemented or not) frontendX is connected to demuxX on the same adapter. You have probably faced other situations. Can you describe any?

I thought we were discussing how to connect frontendX to demuxY on different adapters, since this would be needed for nGene CI.

Quoted 11 lines
Quoted 1 line

c.2) Which CA device can be used with which frontend device?

For built-in descramblers, I'd say each caX is always connected to (built into) demuxX.

For CI slots, this might be different and on the Dreambox we're using a proprietary API to connect CI slots between frontends and demuxes.

Is there any in-tree supported hardware, that has more than one CI slot *and* more than one frontend (usable at the same time)?

NetUP Dual DVB S2 CI

Quoted 9 lines
Quoted 4 lines

The best would be to create independent adapters for each independent CA device (ca0/caio0 pair) - they are independent after all (physically and in the way they're used).

Physically, it's a general purpose TS I/O interface of the nGene chipset. It just happens to be connected to a CI slot. On another board, it might be connected to a modulator or just to some kind of socket.

I agree, but I look at it like at any other general purpose interface (e.g. USB, PCI).

Maybe nGene is not a good case for such analysis, but there is other hardware which would hit this problem again.

I'm aware of two such examples:

1) Hauppauge WinTV-CI (USB attached CI - I think Issa mentioned this one already);
2) DigitalDevices Octopus (PCI bridge with 4 general purpose ports - Ralph mentioned this one and I'm using these cards myself);

Quoted 4 lines

If the next version gets a connector for two switchable CI modules, then the physical independence is gone. You'd have two ca nodes but only one caio node. Or two caio nodes, that can't be used concurrently.

What is a switchable CI module?

Quoted 4 lines

Maybe the next version gets the ability to directly connect the TS input from the frontend to the TS output to the CI slot to save copying around the data, by using some kind of pin mux. Not physically independent either.

When this feature would be in action, opening caioX could return EBUSY and vice versa. This sounds similar to V4L <-> DVB interaction for hybrid devices. API can't change the fact a resource is shared.

Quoted 3 lines

It just looks physically independent in the one configuration implemented now.

I don't believe it's an accident how nGene cards interface with CI. To me it rather looks like a very good feature.

Imagine a use case like this:

There's a machine with:
- DigitalDevices CineS2
- CI-Module attached to CineS2;
- TechniSat SkyStar2 (has no CI);

A user wants to stream two DVB-S2 transponders using CineS2. They are both clear, so CI-Module is not needed.

At the same time, the user wants to stream one DVB-S transponder but it is
scrambled. Since CI-Module attached to CineS2 is not in use, it can be made to work with SkyStar2 using a few lines of code in user space.

Quoted 6 lines
Quoted 2 lines

What I understand you would like to see, is the ability to do direct transfers between independent devices or parts of devices. Is this correct?

Yes, between parts of devices, where the CI input can be fed by both the TS output of the frontend and from memory (e.g. userspace).

I don't know Demux API so well to be able to tell for sure, but it looks like it could be used (with a few extensions) instead of caioX.

One benefit of using Demux API would probably be the ability to have PID filtering (in software or hardware), I think you've mentioned this already. It is also similar to the way on-board decoder can be used on full-featured cards.

This way both cases (nGene and your configurable design) could be covered.

On the other hand, using Demux API for nGene looks like an overkill, and switching of TS route in your case could be done in some other way. Specific HW design related problems seem to be common to both approaches.

Nevertheless, Demux API approach looks cleaner. But on the other hand, it hides the fact that CI can be used in this particular way (sysfs could help).

I imagine there would still be a difference between the two cases:

- nGene (CineS2 with CI-Module)

Device nodes would be:

/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/dvr0

/dev/dvb/adapter1/frontend0
/dev/dvb/adapter1/demux0
/dev/dvb/adapter1/dvr0

/dev/dvb/adapter2/ca0
/dev/dvb/adapter2/demux0
/dev/dvb/adapter2/dvr0

- Configurable Design (dual card similar to NetUP)

Device nodes would be:

/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/ca0

/dev/dvb/adapter1/frontend0
/dev/dvb/adapter1/demux0
/dev/dvb/adapter1/dvr0
/dev/dvb/adapter1/ca0

What do you say about this difference?

Best regards,
Martin Vidovic

#11 lore raw

Hello Martin,

Quoted 11 lines · Martin Vidovic
Quoted 10 lines · Andreas Oberritter
Quoted 3 lines · Martin Vidovic

a) Plug two TerraTec Cinergy T RC MKII and try to distinguish between them.

I don't have any USB or PCI hardware within reach, but if udev is able to create the devices, there should be some way to connect adapters to the bus id through sysfs. I guess that's how it's done with other subsystems, too.

Quoted 6 lines
Quoted 3 lines

If this information is missing from sysfs, would adding it help to solve this problem?

Binding to bus id is not a problem. However, especially for USB devices, it may be useful to have adapter MAC address in sysfs.

a DVB adapter isn't required to have a unique MAC address, but we could add this attribute to sysfs, if present. I think it would be preferrable to use information available from the bus, e.g. the USB serial number. But in cases, where the serial number is unavailable (probably quite often), the MAC address might be a good fallback. It won't be available in every case though.

Quoted 14 lines
Quoted 8 lines
Quoted 2 lines

b) Take a Hybrid terrestrial TV tuner. V4L and DVB APIs (may) use shared resources, how does one find this out?

That's a good question and the same question must be asked for video and audio decoders, which can be controlled by V4L, DVB, ALSA etc.

How does V4L integrate with ALSA?

I don't know.

Quoted 3 lines
Quoted 2 lines

c.1) How does one know which frontend device can be used with which demux device?

Quoted 7 lines
Quoted 4 lines

I'd say by default (i.e. without DMX_SET_SOURCE, whether implemented or not) frontendX is connected to demuxX on the same adapter. You have probably faced other situations. Can you describe any?

I thought we were discussing how to connect frontendX to demuxY on different adapters, since this would be needed for nGene CI.

Such connections between adapters are impossible, API-wise. Each adapter is an independent circuit by definition.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

c.2) Which CA device can be used with which frontend device?

For built-in descramblers, I'd say each caX is always connected to (built into) demuxX.

Quoted 8 lines
Quoted 6 lines

For CI slots, this might be different and on the Dreambox we're using a proprietary API to connect CI slots between frontends and demuxes.

Is there any in-tree supported hardware, that has more than one CI slot *and* more than one frontend (usable at the same time)?

NetUP Dual DVB S2 CI

Nice. Is it possible to assign a CI slot to a frontend by means of software with this card? Or does it appear as two independent circuits on one board?

Quoted 23 lines
Quoted 9 lines
Quoted 4 lines

The best would be to create independent adapters for each independent CA device (ca0/caio0 pair) - they are independent after all (physically and in the way they're used).

Physically, it's a general purpose TS I/O interface of the nGene chipset. It just happens to be connected to a CI slot. On another board, it might be connected to a modulator or just to some kind of socket.

I agree, but I look at it like at any other general purpose interface (e.g. USB, PCI).

Maybe nGene is not a good case for such analysis, but there is other hardware which would hit this problem again.

I'm aware of two such examples:

1) Hauppauge WinTV-CI (USB attached CI - I think Issa mentioned this one already);
2) DigitalDevices Octopus (PCI bridge with 4 general purpose ports - Ralph mentioned this one and I'm using these cards myself);

Quoted 6 lines
Quoted 4 lines

If the next version gets a connector for two switchable CI modules, then the physical independence is gone. You'd have two ca nodes but only one caio node. Or two caio nodes, that can't be used concurrently.

What is a switchable CI module?

Sorry, I meant two normal CI modules and the ability to switch between them, i.e. to only use one of them at a time.

Quoted 9 lines
Quoted 5 lines

Maybe the next version gets the ability to directly connect the TS input from the frontend to the TS output to the CI slot to save copying around the data, by using some kind of pin mux. Not physically independent either.

When this feature would be in action, opening caioX could return EBUSY and vice versa. This sounds similar to V4L <-> DVB interaction for hybrid devices. API can't change the fact a resource is shared.

Indeed. However, what I was trying to explain with this example was, that such a shared resource isn't physically independent and thus has to appear under the same adapter number as the other parts of the circuit it resides on.

Quoted 11 lines
Quoted 3 lines

It just looks physically independent in the one configuration implemented now.

I don't believe it's an accident how nGene cards interface with CI. To me it rather looks like a very good feature.

Imagine a use case like this:

There's a machine with:
- DigitalDevices CineS2

(adapter0)

Quoted 1 line

- CI-Module attached to CineS2;

(adapter0/{ca0,caio0})

Quoted 1 line

- TechniSat SkyStar2 (has no CI);

(adapter1)

Quoted 6 lines

A user wants to stream two DVB-S2 transponders using CineS2. They are both clear, so CI-Module is not needed.

At the same time, the user wants to stream one DVB-S transponder but it is scrambled. Since CI-Module attached to CineS2 is not in use, it can be made to work with SkyStar2 using a few lines of code in user space.

You're right, absolutely. This can of course still be done if ca0 and caio0 reside on adapter0, even if adapter0 also contains frontends, demuxes and stuff.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

What I understand you would like to see, is the ability to do direct transfers between independent devices or parts of devices. Is this correct?

Yes, between parts of devices, where the CI input can be fed by both the TS output of the frontend and from memory (e.g. userspace).

I don't know Demux API so well to be able to tell for sure, but it looks like it could be used (with a few extensions) instead of caioX.

Quoted 6 lines

One benefit of using Demux API would probably be the ability to have PID filtering (in software or hardware), I think you've mentioned this already. It is also similar to the way on-board decoder can be used on full-featured cards.

This way both cases (nGene and your configurable design) could be covered.

I think so, too.

Quoted 7 lines

On the other hand, using Demux API for nGene looks like an overkill, and switching of TS route in your case could be done in some other way. Specific HW design related problems seem to be common to both approaches.

Nevertheless, Demux API approach looks cleaner. But on the other hand, it hides the fact that CI can be used in this particular way (sysfs could help).

In most applications you'll want the PID filtering at the CI's output anyway, so you can use the decrypted stream the same way you'd use it without the CI. In other words, every physical TS input of the chipset (in this case: nGene) should get its own demux interface, e.g. demux0 and demux1 for the frontends, demux2 for the CI.

Whatever we'll agree on, we should define an interface to query the possible inputs and outputs of a demux, be it by means of sysfs or ioctls. This would also be useful to find out which demux can be used with DMX_OUT_DECODER for full-featured cards.

We can add DMX_OUT_CI, DMX_IN_CI, DMX_SOURCE_CI{0,1,2,3...} to the enums in dmx.h. Ideally, in addition to that, I'd prefer dividing descramblers and CIs into ca and ci device nodes, as proposed some days ago.

I think an ioctl to enable bypassing the PID filter when writing to the CI would help to decrease the amount of overkill.

Quoted 10 lines

I imagine there would still be a difference between the two cases:

- nGene (CineS2 with CI-Module)

Device nodes would be:

/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/dvr0

Quoted 7 lines

/dev/dvb/adapter1/frontend0
/dev/dvb/adapter1/demux0
/dev/dvb/adapter1/dvr0

/dev/dvb/adapter2/ca0
/dev/dvb/adapter2/demux0
/dev/dvb/adapter2/dvr0

IMO, this should be:

/dev/dvb/adapter0/ca0 (or better: ci0)
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/demux1
/dev/dvb/adapter0/demux2
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/dvr1
/dev/dvb/adapter0/dvr2
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

(assuming 3 TS inputs)

Quoted 9 lines

- Configurable Design (dual card similar to NetUP)

Device nodes would be:

/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/ca0

Quoted 4 lines

/dev/dvb/adapter1/frontend0
/dev/dvb/adapter1/demux0
/dev/dvb/adapter1/dvr0
/dev/dvb/adapter1/ca0

and

/dev/dvb/adapter0/ca0 (or better: ci0)
/dev/dvb/adapter0/ca1 (or better: ci1)
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/demux1
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/dvr1
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

(assuming 2 TS inputs and a way to map a CI to a frontend)

or your suggestion for NetUP, assuming fixed relations between CI slots and frontends.

Quoted 1 line

What do you say about this difference?

Different capabilities result in different nodes. I don't see anything special about it.

Regards,
Andreas

#12 lore raw

Hi Andreas,

Quoted 6 lines · Andreas Oberritter

Hello Martin,

Quoted 3 lines

Binding to bus id is not a problem. However, especially for USB devices, it may be useful to have adapter MAC address in sysfs.

Quoted 7 lines

a DVB adapter isn't required to have a unique MAC address, but we could add this attribute to sysfs, if present. I think it would be preferrable to use information available from the bus, e.g. the USB serial number. But in cases, where the serial number is unavailable (probably quite often), the MAC address might be a good fallback. It won't be available in every case though.

I'm aware MAC is not required. I used the TerraTec example because the USB serial numbers are the same for both devices (maybe only in my case).

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

c.1) How does one know which frontend device can be used with which demux device?

I'd say by default (i.e. without DMX_SET_SOURCE, whether implemented or not) frontendX is connected to demuxX on the same adapter. You have probably faced other situations. Can you describe any?

Quoted 6 lines
Quoted 2 lines

I thought we were discussing how to connect frontendX to demuxY on different adapters, since this would be needed for nGene CI.

Such connections between adapters are impossible, API-wise. Each adapter is an independent circuit by definition.

I'm using a different definition of DVB adapter:

DVB adapter is a collection of related DVB device nodes which can be used independently from (without side effects for) other DVB device nodes in the system.

Quoted 7 lines
Quoted 2 lines

NetUP Dual DVB S2 CI

Nice. Is it possible to assign a CI slot to a frontend by means of software with this card? Or does it appear as two independent circuits on one board?

The latter.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

If the next version gets a connector for two switchable CI modules, then the physical independence is gone. You'd have two ca nodes but only one caio node. Or two caio nodes, that can't be used concurrently.

What is a switchable CI module?

Sorry, I meant two normal CI modules and the ability to switch between them, i.e. to only use one of them at a time.

It looks like an odd HW design, but it can make sense for certain use cases. I think this would call for some different API extension, because there's effectively only one CI bus, but the SW would need to be able to bind a certain physical CI bus to this logical bus.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Maybe the next version gets the ability to directly connect the TS input from the frontend to the TS output to the CI slot to save copying around the data, by using some kind of pin mux. Not physically independent either.

Quoted 9 lines
Quoted 3 lines

When this feature would be in action, opening caioX could return EBUSY and vice versa. This sounds similar to V4L <-> DVB interaction for hybrid devices. API can't change the fact a resource is shared.

Indeed. However, what I was trying to explain with this example was, that such a shared resource isn't physically independent and thus has to appear under the same adapter number as the other parts of the circuit it resides on.

How about this device: TeVii S480

This board integrates a USB controller and two TeVii S660 devices on
a single PCIe card. Why would a driver be required to handle this
situation any differently than having two actual S660's attached to a USB controller sitting on PCI?

Quoted 25 lines
Quoted 11 lines
Quoted 3 lines

It just looks physically independent in the one configuration implemented now.

I don't believe it's an accident how nGene cards interface with CI. To me it rather looks like a very good feature.

Imagine a use case like this:

There's a machine with:
- DigitalDevices CineS2

(adapter0)

Quoted 1 line

- CI-Module attached to CineS2;

(adapter0/{ca0,caio0})

Quoted 1 line

- TechniSat SkyStar2 (has no CI);

(adapter1)

Quoted 3 lines

A user wants to stream two DVB-S2 transponders using CineS2. They are both clear, so CI-Module is not needed.

Quoted 8 lines
Quoted 3 lines

At the same time, the user wants to stream one DVB-S transponder but it is scrambled. Since CI-Module attached to CineS2 is not in use, it can be made to work with SkyStar2 using a few lines of code in user space.

You're right, absolutely. This can of course still be done if ca0 and caio0 reside on adapter0, even if adapter0 also contains frontends, demuxes and stuff.

I agree, but I don't use udev for DVB/V4L, so on my systems they will not reside on the same logical adapter.

Quoted 20 lines
Quoted 9 lines

I don't know Demux API so well to be able to tell for sure, but it looks like it could be used (with a few extensions) instead of caioX.

One benefit of using Demux API would probably be the ability to have PID filtering (in software or hardware), I think you've mentioned this already. It is also similar to the way on-board decoder can be used on full-featured cards.

This way both cases (nGene and your configurable design) could be covered.

I think so, too.

Quoted 7 lines

On the other hand, using Demux API for nGene looks like an overkill, and switching of TS route in your case could be done in some other way. Specific HW design related problems seem to be common to both approaches.

Nevertheless, Demux API approach looks cleaner. But on the other hand, it hides the fact that CI can be used in this particular way (sysfs could help).

Quoted 6 lines

In most applications you'll want the PID filtering at the CI's output anyway, so you can use the decrypted stream the same way you'd use it without the CI. In other words, every physical TS input of the chipset (in this case: nGene) should get its own demux interface, e.g. demux0 and demux1 for the frontends, demux2 for the CI.

PID filtering on CI's output makes sense. However, I'm not sure if it really presents a significant benefit for most applications.

I'm also not sure every TS port needs a demux device. DVB API documentation says a demux should allow multiple sessions and it should be possible to configure the same demux device to use different inputs &| outputs (the enums) for individual sessions.

Quoted 5 lines

Whatever we'll agree on, we should define an interface to query the possible inputs and outputs of a demux, be it by means of sysfs or ioctls. This would also be useful to find out which demux can be used with DMX_OUT_DECODER for full-featured cards.

My view of sysfs vs. ioctl: I think both should provide equivalent infrastructure for querying device capabilities. Sometimes it is necessary to know what kind of device I'm dealing with at the time of device node creation or later at device enumeration.

How do you know which device is S2, T, C (or something else) without resorting to ioctl's?

Quoted 4 lines

We can add DMX_OUT_CI, DMX_IN_CI, DMX_SOURCE_CI{0,1,2,3...} to the enums in dmx.h. Ideally, in addition to that, I'd prefer dividing descramblers and CIs into ca and ci device nodes, as proposed some days ago.

I've had a few thoughts before and after writing the last email.

One is: It looks to me like ASI cards would require a similar interface, and this makes enums somewhat unattractive (maybe only at first sight).

The other: DVR device looks sort of tailored for the on-board decoder. So, it may make more sense if we add CAIO to Demux API. Both dvrX and caioX would be configured using ioctl's on demux0.

Rough examples:

Assume:

typedef enum

{
	DMX_OUT_DECODER,
	DMX_OUT_CI,
	DMX_OUT_TAP,
	DMX_OUT_TS_TAP
} dmx_output_t;

typedef enum

{
	DMX_IN_FRONTEND,
	DMX_IN_CI,
	DMX_IN_DVR,
	DMX_IN_CAIO
} dmx_input_t;

Then:

- Equivalent of status quo (secX/caioX):

	1. open demux0 and set:

	dmx_pes_filter_params {
		pid: 0x2000,
		input: DMX_IN_FRONTEND,
		output: DMX_OUT_TAP,
		pes_type: DMX_PES_OTHER,
		flags: DMX_IMMEDIATE_START
	}

	2. open demux0 and set:

	dmx_pes_filter_params {
		pid: 0x2000,
		input: DMX_IN_CAIO,
		output: DMX_OUT_CI,
		pes_type: DMX_PES_OTHER,
		flags: DMX_IMMEDIATE_START
	}

	3. open demux0 and set:

	dmx_pes_filter_params {
		pid: 0x2000,
		input: DMX_IN_CI,
		output: DMX_OUT_TAP, // or DMX_OUT_TS_TAP
		pes_type: DMX_PES_OTHER,
		flags: DMX_IMMEDIATE_START
	}

- HW/SW (in-kernel) TS passing:

	1. open demux0 and set:

	dmx_pes_filter_params {
		pid: 0x2000,
		input: DMX_IN_FRONTEND,
		output: DMX_OUT_CI,
		pes_type: DMX_PES_OTHER,
		flags: DMX_IMMEDIATE_START
	}

	2. open demux0 and set:

	dmx_pes_filter_params {
		pid: 0x2000,
		input: DMX_IN_CI,
		output: DMX_OUT_TAP, // or DMX_OUT_TS_TAP
		pes_type: DMX_PES_OTHER,
		flags: DMX_IMMEDIATE_START
	}
Quoted 3 lines

I think an ioctl to enable bypassing the PID filter when writing to the CI would help to decrease the amount of overkill.

By overkill I meant that Demux API has features which may not be needed in the nGene case, and that implementing CAIO with Demux API may be more difficult than what we have now (SEC). Use may also be more complicated.

Quoted 16 lines
Quoted 3 lines

I imagine there would still be a difference between the two cases:

- nGene (CineS2 with CI-Module)

IMO, this should be:

/dev/dvb/adapter0/ca0 (or better: ci0)
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/demux1
/dev/dvb/adapter0/demux2
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/dvr1
/dev/dvb/adapter0/dvr2
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

Quoted 1 line

(assuming 3 TS inputs)

Another version:

/dev/dvb/adapter0/ca0
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/caio0
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

One could use 3 TS inputs this way too.

Quoted 13 lines
Quoted 1 line

- Configurable Design (dual card similar to NetUP)

and

/dev/dvb/adapter0/ca0 (or better: ci0)
/dev/dvb/adapter0/ca1 (or better: ci1)
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/demux1
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/dvr1
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

Quoted 5 lines

(assuming 2 TS inputs and a way to map a CI to a frontend)

or your suggestion for NetUP, assuming fixed relations between CI slots and frontends.

Fixed relations indeed. Alternatively:

/dev/dvb/adapter0/ca0
/dev/dvb/adapter0/ca1
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

Quoted 7 lines
Quoted 1 line

What do you say about this difference?

Different capabilities result in different nodes. I don't see anything special about it.

Regards,
Andreas

Best regards,
Martin

#13 lore raw
Quoted 35 lines · Martin Vidovic

Hi Andreas,

Quoted 6 lines · Andreas Oberritter

Hello Martin,

Quoted 3 lines

Binding to bus id is not a problem. However, especially for USB devices, it may be useful to have adapter MAC address in sysfs.

Quoted 7 lines

a DVB adapter isn't required to have a unique MAC address, but we could add this attribute to sysfs, if present. I think it would be preferrable to use information available from the bus, e.g. the USB serial number. But in cases, where the serial number is unavailable (probably quite often), the MAC address might be a good fallback. It won't be available in every case though.

I'm aware MAC is not required. I used the TerraTec example because the USB serial numbers are the same for both devices (maybe only in my case).

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

c.1) How does one know which frontend device can be used with which demux device?

I'd say by default (i.e. without DMX_SET_SOURCE, whether implemented or not) frontendX is connected to demuxX on the same adapter. You have probably faced other situations. Can you describe any?

Quoted 6 lines
Quoted 2 lines

I thought we were discussing how to connect frontendX to demuxY on different adapters, since this would be needed for nGene CI.

Such connections between adapters are impossible, API-wise. Each adapter is an independent circuit by definition.

Quoted 5 lines

I'm using a different definition of DVB adapter:

DVB adapter is a collection of related DVB device nodes which can be used independently from (without side effects for) other DVB device nodes in the system.

I'd agree if you'd modify your definition to read "which can *only* be used independently from [...] other DVB devices nodes [...]".

frontendX and demuxY of different adapters simply can't be both independent from each other and connected to each other at the same time.

Quoted 45 lines
Quoted 6 lines
Quoted 1 line

NetUP Dual DVB S2 CI

Nice. Is it possible to assign a CI slot to a frontend by means of software with this card? Or does it appear as two independent circuits on one board?

The latter.

Quoted 11 lines
Quoted 7 lines
Quoted 5 lines

If the next version gets a connector for two switchable CI modules, then
the physical independence is gone. You'd have two ca nodes but only one caio node. Or two caio nodes, that can't be used concurrently.

What is a switchable CI module?

Sorry, I meant two normal CI modules and the ability to switch between them, i.e. to only use one of them at a time.

It looks like an odd HW design, but it can make sense for certain use cases. I think this would call for some different API extension, because there's effectively only one CI bus, but the SW would need to be able to bind a certain physical CI bus to this logical bus.

Quoted 13 lines
Quoted 8 lines
Quoted 7 lines

Maybe the next version gets the ability to directly connect the TS input
from the frontend to the TS output to the CI slot to save copying around
the data, by using some kind of pin mux. Not physically independent either.

Quoted 4 lines

When this feature would be in action, opening caioX could return EBUSY and vice versa. This sounds similar to V4L <-> DVB interaction for hybrid
devices. API can't change the fact a resource is shared.

Quoted 5 lines

Indeed. However, what I was trying to explain with this example was, that such a shared resource isn't physically independent and thus has to appear under the same adapter number as the other parts of the circuit it resides on.

Quoted 6 lines

How about this device: TeVii S480

This board integrates a USB controller and two TeVii S660 devices on a single PCIe card. Why would a driver be required to handle this situation any differently than having two actual S660's attached to a USB controller sitting on PCI?

I think my statement was mistakable. By independent circuits I was covering only the data reception path. Of course, multiple circuits may share the same board and thus be connected to each other somehow, e.g. sharing a PCIe bridge. Still they appear to be independent to the user, because the components used in the individual paths can not be shared (reordered or interconnected by software).

Quoted 30 lines
Quoted 30 lines
Quoted 11 lines
Quoted 3 lines

It just looks physically independent in the one configuration implemented now.

I don't believe it's an accident how nGene cards interface with CI. To me it rather looks like a very good feature.

Imagine a use case like this:

There's a machine with:
- DigitalDevices CineS2

(adapter0)

Quoted 1 line

- CI-Module attached to CineS2;

(adapter0/{ca0,caio0})

Quoted 1 line

- TechniSat SkyStar2 (has no CI);

(adapter1)

Quoted 7 lines

A user wants to stream two DVB-S2 transponders using CineS2. They are both clear, so CI-Module is not needed.

At the same time, the user wants to stream one DVB-S transponder but it is
scrambled. Since CI-Module attached to CineS2 is not in use, it can be made to work with SkyStar2 using a few lines of code in user space.

Quoted 7 lines
Quoted 4 lines

You're right, absolutely. This can of course still be done if ca0 and caio0 reside on adapter0, even if adapter0 also contains frontends, demuxes and stuff.

I agree, but I don't use udev for DVB/V4L, so on my systems they will not reside on the same logical adapter.

The way devices are named in userspace (by udev or anything else) on your system doesn't matter at all. Upon device registration, dvb_register_device gets called with an adapter passed as a parameter. This creates the logical association between device node and adapter we're discussing. The default scheme used by udev just happens to display this association 1:1.

Quoted 32 lines
Quoted 25 lines
Quoted 10 lines

I don't know Demux API so well to be able to tell for sure, but it looks like it could be used (with a few extensions) instead of caioX.

One benefit of using Demux API would probably be the ability to have PID filtering (in software or hardware), I think you've mentioned this already.
It is also similar to the way on-board decoder can be used on full-featured
cards.

Quoted 2 lines

This way both cases (nGene and your configurable design) could be covered.

I think so, too.

Quoted 9 lines

On the other hand, using Demux API for nGene looks like an overkill, and switching of TS route in your case could be done in some other way. Specific HW design related problems seem to be common to both approaches.

Nevertheless, Demux API approach looks cleaner. But on the other hand, it
hides the fact that CI can be used in this particular way (sysfs could help).

Quoted 6 lines

In most applications you'll want the PID filtering at the CI's output anyway, so you can use the decrypted stream the same way you'd use it without the CI. In other words, every physical TS input of the chipset (in this case: nGene) should get its own demux interface, e.g. demux0 and demux1 for the frontends, demux2 for the CI.

Quoted 2 lines

PID filtering on CI's output makes sense. However, I'm not sure if it really presents a significant benefit for most applications.

Otherwise, the application needs to implement a PID filter by itself.

Quoted 4 lines

I'm also not sure every TS port needs a demux device. DVB API documentation says a demux should allow multiple sessions and it should be possible to configure the same demux device to use different inputs &| outputs (the enums) for individual sessions.

Is this really documented somewhere that way? I'm asking, because it won't work. Think about the dvr device, for example. You really need a dvr device for each concurrent TS input, but dvr devices are implicitly bound to demux devices with the same number. I'm not a big fan of the dvr device, but it's already there and used by many applications.

Quoted 6 lines
Quoted 5 lines

Whatever we'll agree on, we should define an interface to query the possible inputs and outputs of a demux, be it by means of sysfs or ioctls. This would also be useful to find out which demux can be used with DMX_OUT_DECODER for full-featured cards.

Quoted 7 lines

My view of sysfs vs. ioctl: I think both should provide equivalent infrastructure for querying device capabilities. Sometimes it is necessary to know what kind of device I'm dealing with at the time of device node creation or later at device enumeration.

How do you know which device is S2, T, C (or something else) without resorting to ioctl's?

Exporting some data to userspace through sysfs would be nice, indeed. Having to open a frontend node, and thus causing a lengthy firmware upload for many of the newer demods, sucks if you just want to find out the supported delivery system(s).

Quoted 5 lines
Quoted 4 lines

We can add DMX_OUT_CI, DMX_IN_CI, DMX_SOURCE_CI{0,1,2,3...} to the enums in dmx.h. Ideally, in addition to that, I'd prefer dividing descramblers and CIs into ca and ci device nodes, as proposed some days ago.

Quoted 8 lines

I've had a few thoughts before and after writing the last email.

One is: It looks to me like ASI cards would require a similar interface, and this makes enums somewhat unattractive (maybe only at first sight).

The other: DVR device looks sort of tailored for the on-board decoder. So, it may make more sense if we add CAIO to Demux API. Both dvrX and caioX would be configured using ioctl's on demux0.

demuxX instead of demux0. Writing to dvr just feeds a TS to the demux. It may be used with a decoder, but doesn't necessarily have to.

We can influence the behaviour of the dvr device (or of the demux device) by adding an ioctl to disable the TS parser.

Quoted 36 lines

Rough examples:

Assume:

typedef enum

{
    DMX_OUT_DECODER,
    DMX_OUT_CI,
    DMX_OUT_TAP,
    DMX_OUT_TS_TAP
} dmx_output_t;

typedef enum

{
    DMX_IN_FRONTEND,
    DMX_IN_CI,
    DMX_IN_DVR,
    DMX_IN_CAIO
} dmx_input_t;

Then:

- Equivalent of status quo (secX/caioX):

    1. open demux0 and set:

    dmx_pes_filter_params {
        pid: 0x2000,
        input: DMX_IN_FRONTEND,
        output: DMX_OUT_TAP,
        pes_type: DMX_PES_OTHER,
        flags: DMX_IMMEDIATE_START
    }

    2. open demux0 and set:
Quoted 7 lines
    dmx_pes_filter_params {
        pid: 0x2000,
        input: DMX_IN_CAIO,
        output: DMX_OUT_CI,
        pes_type: DMX_PES_OTHER,
        flags: DMX_IMMEDIATE_START
    }

You're using DMX_IN_CAIO to pass raw data (in this case an unfiltered TS) to any output (in this case to a CI). This invalidates the reason to call it "caio" in the first place.

Quoted 61 lines
    3. open demux0 and set:

    dmx_pes_filter_params {
        pid: 0x2000,
        input: DMX_IN_CI,
        output: DMX_OUT_TAP, // or DMX_OUT_TS_TAP
        pes_type: DMX_PES_OTHER,
        flags: DMX_IMMEDIATE_START
    }

- HW/SW (in-kernel) TS passing:

    1. open demux0 and set:

    dmx_pes_filter_params {
        pid: 0x2000,
        input: DMX_IN_FRONTEND,
        output: DMX_OUT_CI,
        pes_type: DMX_PES_OTHER,
        flags: DMX_IMMEDIATE_START
    }

    2. open demux0 and set:

    dmx_pes_filter_params {
        pid: 0x2000,
        input: DMX_IN_CI,
        output: DMX_OUT_TAP, // or DMX_OUT_TS_TAP
        pes_type: DMX_PES_OTHER,
        flags: DMX_IMMEDIATE_START
    }
Quoted 3 lines

I think an ioctl to enable bypassing the PID filter when writing to the CI would help to decrease the amount of overkill.

By overkill I meant that Demux API has features which may not be needed in the nGene case, and that implementing CAIO with Demux API may be more difficult than what we have now (SEC). Use may also be more complicated.

Quoted 16 lines
Quoted 3 lines

I imagine there would still be a difference between the two cases:

- nGene (CineS2 with CI-Module)

IMO, this should be:

/dev/dvb/adapter0/ca0 (or better: ci0)
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/demux1
/dev/dvb/adapter0/demux2
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/dvr1
/dev/dvb/adapter0/dvr2
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

Quoted 1 line

(assuming 3 TS inputs)

Another version:

Quoted 8 lines

/dev/dvb/adapter0/ca0
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/caio0
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

One could use 3 TS inputs this way too.

But then you can record only one TS at a time through dvr.

Regards,
Andreas

Quoted 43 lines
Quoted 13 lines
Quoted 1 line

- Configurable Design (dual card similar to NetUP)

and

/dev/dvb/adapter0/ca0 (or better: ci0)
/dev/dvb/adapter0/ca1 (or better: ci1)
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/demux1
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/dvr1
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

Quoted 5 lines

(assuming 2 TS inputs and a way to map a CI to a frontend)

or your suggestion for NetUP, assuming fixed relations between CI slots and frontends.

Fixed relations indeed. Alternatively:

/dev/dvb/adapter0/ca0
/dev/dvb/adapter0/ca1
/dev/dvb/adapter0/demux0
/dev/dvb/adapter0/dvr0
/dev/dvb/adapter0/frontend0
/dev/dvb/adapter0/frontend1

Quoted 7 lines
Quoted 1 line

What do you say about this difference?

Different capabilities result in different nodes. I don't see anything special about it.

Regards,
Andreas

Best regards,
Martin

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html