Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2012 20:51:35 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        Timo =?iso-8859-1?Q?Sch=E4fer?= <mlist@itservice-schaefer.de>
Cc:        freebsd-multimedia@freebsd.org, Juergen Lock <nox@jelal.kn-bremen.de>
Subject:   Re: DVB-C (CT-3650) with UnityMedia CI Module not working
Message-ID:  <20120626185135.GA73840@triton8.kn-bremen.de>
In-Reply-To: <4FE9FF30.9070103@itservice-schaefer.de>
References:  <4FE83768.6000909@itservice-schaefer.de> <4FE9D99F.5000005@itservice-schaefer.de> <4FE9DB34.7010806@itservice-schaefer.de> <201206261725.q5QHPV4r070734@triton8.kn-bremen.de> <20120626174614.GA71689@triton8.kn-bremen.de> <4FE9FF30.9070103@itservice-schaefer.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 26, 2012 at 08:28:00PM +0200, Timo Schäfer wrote:
> Am 26.06.2012 19:46, schrieb Juergen Lock:
> > On Tue, Jun 26, 2012 at 07:25:31PM +0200, Juergen Lock wrote:
> >> In article <201206261804.05819.hselasky@c2i.net> you write:
> >>> On Tuesday 26 June 2012 17:54:28 Timo Schäfer wrote:
> >>>> Am 26.06.2012 17:47, schrieb Timo Schäfer:
> >>>>> Am 26.06.2012 17:37, schrieb Hans Petter Selasky:
> >>>>>> On Monday 25 June 2012 17:48:05 Timo Schäfer wrote:
> >>>>>>> ./adapter0/ca0
> >>>>>> Can you use the device shown above?
> >>>>>>
> >>>>>> --HPS
> >>>>> how? vdr is not talking to it / does not detect it.
> >>>>>
> >>>>> under linux vdr looks at the attached ci module and inserted smartcard
> >>>>> to unscramble
> >>>>> the channel if needed.
> >>>>>
> >>>>> with my freebsd setup vdr does not detect the ci module and cannot use
> >>>>> the smartcard
> >>>>> to open the scrambled channels.
> >>>>>
> >>>>> crw-rw----  1 webcamd  webcamd    0,  97 Jun 26 17:40 ca0
> >>>>>
> >>>>> has the needed rights, but i guess its not used/detected.
> >>>> Ah there is something in /var/log/messages:
> >>>>
> >>>> Jun 26 14:00:20 barney vdr: [680406016] ERROR: can't get info of CAM
> >>>> slot 0 on device 0: Invalid argument
> >>>> Jun 26 14:00:28 barney last message repeated 15 times
> >>> Hi,
> >>>
> >>>> does not look good but that seems to be the problem.
> >>> Maybe it is a known IOCTL issue. Some IOCTL needs to be fixed before they can
> >>> be used, because the RW flags are not correct.
> >>>
> >>> Try figuring out what IOCTL this is with ktrace or something like that. Or
> >>> simply grep in the code for that error message. Then see if the RW flags are
> >>> correct.
> >> Bingo! :)  At least CA_GET_SLOT_INFO needs to be _IOWR not _IOR.
> >> Try this patch in ports/multimedia/v4l_compat/files/patch-dvb-ca.h:
> >>
> >> --- dvb/ca.h.orig
> >> +++ dvb/ca.h
> >> @@ -80,7 +80,13 @@ typedef struct ca_pid {
> >>   
> >>   #define CA_RESET          _IO('o', 128)
> >>   #define CA_GET_CAP        _IOR('o', 129, ca_caps_t)
> >> +
> >> +/* At least CA_GET_SLOT_INFO needs to be _IOWR not _IOR.
> >> + * This is wrong on Linux too but there the driver doesn't care.
> >> + *
> >>   #define CA_GET_SLOT_INFO  _IOR('o', 130, ca_slot_info_t)
> >> + */
> >> +#define CA_GET_SLOT_INFO  _IOWR('o', 130, ca_slot_info_t)
> >>   #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
> >>   #define CA_GET_MSG        _IOR('o', 132, ca_msg_t)
> >>   #define CA_SEND_MSG       _IOW('o', 133, ca_msg_t)
> >>
> >> .and a very similar one in
> >> ports/multimedia/webcamd/files/patch-media_tree-include-linux-dvb-ca.h:
> >>
> >> --- media_tree/include/linux/dvb/ca.h.orig
> >> +++ media_tree/include/linux/dvb/ca.h
> >> @@ -80,7 +80,13 @@ typedef struct ca_pid {
> >>   
> >>   #define CA_RESET          _IO('o', 128)
> >>   #define CA_GET_CAP        _IOR('o', 129, ca_caps_t)
> >> +
> >> +/* At least CA_GET_SLOT_INFO needs to be _IOWR not _IOR.
> >> + * This is wrong on Linux too but there the driver doesn't care.
> >> + *
> >>   #define CA_GET_SLOT_INFO  _IOR('o', 130, ca_slot_info_t)
> >> + */
> >> +#define CA_GET_SLOT_INFO  _IOWR('o', 130, ca_slot_info_t)
> >>   #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
> >>   #define CA_GET_MSG        _IOR('o', 132, ca_msg_t)
> >>   #define CA_SEND_MSG       _IOW('o', 133, ca_msg_t)
> >>
> >>   and then rebuild these two and multimedia/vdr too.
> >>
> >>   Good luck, :)
> >> 	Juergen
> >>
> >> PS: The submitter of the WebcamCompat wiki TT S2-3650 entry told me
> >> he tested the CI too, I wonder what he tested...  (Or maybe the old
> >> vdr version ignored the error?)
> > And seems CA_GET_MSG needs to be _IOWR too, tho vdr doesn't use it
> > so the two patches should still be enough for testing.
> >
> > 	Juergen
> > _______________________________________________
> > freebsd-multimedia@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-multimedia
> > To unsubscribe, send any mail to "freebsd-multimedia-unsubscribe@freebsd.org"
> 
> YES!
> 
> Thank you Hans Petter and Jürgen,
> 
> after applying the patches:
> 
> un 26 20:22:23 barney vdr: [680397824] CAM 1: module present
> Jun 26 20:22:25 barney vdr: [680397824] CAM 1: module ready
> Jun 26 20:22:28 barney vdr: [680397824] CAM 1: AlphaCrypt, 01, 4A20, 4A20
> Jun 26 20:22:29 barney vdr: [680403968] CAM 1: assigned to device 1
> Jun 26 20:22:33 barney vdr: [680403968] CAM 1: unassigned
> Jun 26 20:22:37 barney vdr: [680403968] CAM 1: assigned to device 1
> 
> CAM works now and unscrambles the crypted channels my smartcard enables to.

Cool! :)  Would you like to submit an entry for the wiki now about
your tuner?

	http://wiki.freebsd.org/WebcamCompat

 Thanx!

 And here comes the full patch for ports/multimedia, does this look
ok to commit?

Index: v4l_compat/Makefile
===================================================================
RCS file: /home/pcvs/ports/multimedia/v4l_compat/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- v4l_compat/Makefile	10 May 2012 06:55:56 -0000	1.11
+++ v4l_compat/Makefile	26 Jun 2012 18:37:46 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	v4l_compat
 PORTVERSION=	1.0.${DUMMYDATE}
+PORTREVISION=	1
 CATEGORIES=	multimedia
 MASTER_SITES=	LOCAL/kwm
 
Index: webcamd/Makefile
===================================================================
RCS file: /home/pcvs/ports/multimedia/webcamd/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- webcamd/Makefile	26 Jun 2012 16:58:00 -0000	1.23
+++ webcamd/Makefile	26 Jun 2012 18:37:46 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	webcamd
 PORTVERSION=	3.6.0.1
+PORTREVISION=	1
 CATEGORIES=	multimedia
 MASTER_SITES=	http://www.selasky.org/hans_petter/distfiles/ \
 		http://hselasky.homeunix.org:8192/distfiles/
Index: vdr/Makefile
===================================================================
RCS file: /home/pcvs/ports/multimedia/vdr/Makefile,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile
--- vdr/Makefile	19 Jun 2012 18:42:07 -0000	1.19
+++ vdr/Makefile	26 Jun 2012 18:37:48 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	vdr
 PORTVERSION=	1.7.28
+PORTREVISION=	1
 CATEGORIES=	multimedia
 MASTER_SITES=	ftp://ftp.tvdr.de/vdr/Developer/
 
Index: linux_dvbwrapper-kmod/Makefile
===================================================================
RCS file: /home/pcvs/ports/multimedia/linux_dvbwrapper-kmod/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- linux_dvbwrapper-kmod/Makefile	27 Sep 2011 17:37:18 -0000	1.3
+++ linux_dvbwrapper-kmod/Makefile	26 Jun 2012 18:37:48 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	linux_dvbwrapper-kmod
 PORTVERSION=	1.0
+PORTREVISION=	1
 CATEGORIES=	multimedia kld
 DISTFILES=	# none
 
Index: linux_dvbwrapper-kmod/files/linux_dvbwrapper.c
===================================================================
RCS file: /home/pcvs/ports/multimedia/linux_dvbwrapper-kmod/files/linux_dvbwrapper.c,v
retrieving revision 1.2
diff -u -p -r1.2 linux_dvbwrapper.c
--- linux_dvbwrapper-kmod/files/linux_dvbwrapper.c	27 Sep 2011 17:37:18 -0000	1.2
+++ linux_dvbwrapper-kmod/files/linux_dvbwrapper.c	26 Jun 2012 18:37:48 -0000
@@ -263,13 +263,13 @@ linux_ioctl_dvb(struct thread *td, struc
 	case LINUX_FE_GET_FRONTEND:
 	case LINUX_FE_GET_EVENT:
 	case LINUX_CA_GET_CAP:
-	case LINUX_CA_GET_SLOT_INFO:
 	case LINUX_CA_GET_DESCR_INFO:
-	case LINUX_CA_GET_MSG:
 		args->cmd = (args->cmd & ~IOC_DIRMASK) | IOC_OUT;
 		break;
 
 	case LINUX_DMX_GET_STC:
+	case LINUX_CA_GET_SLOT_INFO:
+	case LINUX_CA_GET_MSG:
 	case LINUX_NET_GET_IF:
 	net_add_if:
 		args->cmd = (args->cmd & ~IOC_DIRMASK) | IOC_INOUT;
Index: v4l_compat/files/patch-dvb-ca.h
@@ -0,0 +1,20 @@
+--- dvb/ca.h.orig
++++ dvb/ca.h
+@@ -80,9 +80,17 @@ typedef struct ca_pid {
+ 
+ #define CA_RESET          _IO('o', 128)
+ #define CA_GET_CAP        _IOR('o', 129, ca_caps_t)
++
++/* At least CA_GET_SLOT_INFO and CA_GET_MSG need to be _IOWR not _IOR.
++ * This is wrong on Linux too but there the driver doesn't care.
++ *
+ #define CA_GET_SLOT_INFO  _IOR('o', 130, ca_slot_info_t)
+ #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
+ #define CA_GET_MSG        _IOR('o', 132, ca_msg_t)
++ */
++#define CA_GET_SLOT_INFO  _IOWR('o', 130, ca_slot_info_t)
++#define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
++#define CA_GET_MSG        _IOWR('o', 132, ca_msg_t)
+ #define CA_SEND_MSG       _IOW('o', 133, ca_msg_t)
+ #define CA_SET_DESCR      _IOW('o', 134, ca_descr_t)
+ #define CA_SET_PID        _IOW('o', 135, ca_pid_t)
Index: webcamd/files/patch-media_tree-include-linux-dvb-ca.h
@@ -0,0 +1,20 @@
+--- media_tree/include/linux/dvb/ca.h.orig
++++ media_tree/include/linux/dvb/ca.h
+@@ -80,9 +80,17 @@ typedef struct ca_pid {
+ 
+ #define CA_RESET          _IO('o', 128)
+ #define CA_GET_CAP        _IOR('o', 129, ca_caps_t)
++
++/* At least CA_GET_SLOT_INFO and CA_GET_MSG need to be _IOWR not _IOR.
++ * This is wrong on Linux too but there the driver doesn't care.
++ *
+ #define CA_GET_SLOT_INFO  _IOR('o', 130, ca_slot_info_t)
+ #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
+ #define CA_GET_MSG        _IOR('o', 132, ca_msg_t)
++ */
++#define CA_GET_SLOT_INFO  _IOWR('o', 130, ca_slot_info_t)
++#define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
++#define CA_GET_MSG        _IOWR('o', 132, ca_msg_t)
+ #define CA_SEND_MSG       _IOW('o', 133, ca_msg_t)
+ #define CA_SET_DESCR      _IOW('o', 134, ca_descr_t)
+ #define CA_SET_PID        _IOW('o', 135, ca_pid_t)

PS: maybe the TT S2-3650 CI worked because it was index 0, since for _IOR
ioctls the buffer is zeroed...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120626185135.GA73840>