From owner-freebsd-multimedia@FreeBSD.ORG Mon Apr 16 05:50:58 2007 Return-Path: X-Original-To: freebsd-multimedia@freebsd.org Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B304A16A403 for ; Mon, 16 Apr 2007 05:50:58 +0000 (UTC) (envelope-from grog@lemis.com) Received: from ozlabs.org (ozlabs.org [203.10.76.45]) by mx1.freebsd.org (Postfix) with ESMTP id 4258713C465 for ; Mon, 16 Apr 2007 05:50:58 +0000 (UTC) (envelope-from grog@lemis.com) Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.135]) by ozlabs.org (Postfix) with ESMTP id DF23CDDE30; Mon, 16 Apr 2007 15:50:55 +1000 (EST) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id 7C2E51A9801; Mon, 16 Apr 2007 15:20:55 +0930 (CST) Date: Mon, 16 Apr 2007 15:20:55 +0930 From: Greg 'groggy' Lehey To: usleepless@gmail.com Message-ID: <20070416055055.GC1593@wantadilla.lemis.com> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Q0rSlbzrZN6k9QnT" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 VoIP: sip:0871270137@sip.internode.on.net WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Cc: freebsd-multimedia@freebsd.org Subject: Re: pvrxxx, linux code and modules X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2007 05:50:58 -0000 --Q0rSlbzrZN6k9QnT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Monday, 16 April 2007 at 0:08:14 +0200, Jan Branbergen wrote: > Greg, > > i am writing you because i know you are an experienced freebsd > developer and you are the maintainer of the mythtv port. > > i am trying to get the pvrxxx port to support as many cards as possible. > > in the process, i have been using linux source code to get the job > done. i have defined a .h file full of defines and redefines so i can > include linux-source with as little altertation as possible: > - include fbsd-compat.h file > - run sed over the source-file to replace "struct i2c_client" by "device_t" > - uncomment some stuff i can't solve with the fbsd-compat.h file ( > the linux attach routines ) > - add some stuff ( couple of lines ) to support fbsd-compat.h > - create an entry point to call the main function of the linux-module > - link it in This is all quite interesting. Can you point me to the code (privately if you prefer)? What state is the code in? > however, i feel that it should be possible to create separate > kernel-modules of these linux-modules: tuner.ko, tveeprom.ko, > cx25840.ko etc.... > > but i don't have the knowledge to make this happen: > - how do i create an entry point into the module ( which i can call > to get work done? ) I could tell you for storage devices (I wrote the corresponding code for Vinum), but I'm not very well informed about tuners. Your best bet here is to look at existing code. Take a look at bktr_mem_modevent in /usr/src/sys/dev/bktr/bktr_mem.c. At the very end of this file you'll also find the declaration for the module. The variables SI_SUB_DRIVERS and SI_ORDER_FIRST determine the sequence in which the driver is called for probing. Both are deefined in /usr/src/sys/sys/kernel.h. > i would appreciate if you would take a look at what i have done with > tuner.c, tveeprom.c, tda9887.c, cx25840-core.c etc in the pvrxxx > port. Can you point me to the latest version (preferably a static URL)? I've put in a link to the latest version I know in multimedia/mythtv/pkg-descr, but it's related to a date. > would it be possible to create an automated procedure to transform > these linux-modules to freebsd-modules at the source level? Everything's possible, but I'd expect that to be far more work than would be worthwhile. > for example: the bktr driver would be able to use the same tuner.ko > as the pvrxxx driver does ( a module based on the linux source ). One big problem we'd have with this kind of code is the licensing issue. I started preparing to import your code to the tree, but there's so much GPL stuff in there that it's a real problem. I've been thinking around this general issue for a while, and haven't come to any concrete conclusions. Thoughts: - I need to understand better how tuners work. I've been thinking of writing a document on the subject, something that people could use for help when writing drivers. If you know of anything, even partial or badly laid out, please let me know. - We need to decide on the driver architecture we use. Our current tuner drivers (both of them!) use an interface that is incompatible with V4L. V4L has a number of advantages, including complexity and likelihood of change, but it's the de facto standard, and if we get involved, we may be able to help improve the definition. - Luigi has done some related work on USB webcams. Take a look at http://info.iet.unipi.it/~luigi/FreeBSD/linux_bsd_kld.html . I've been meaning to read it for a while, but haven't got a round tuit yet. I expect two advantages from this approach: - It should be relatively easy to add new drivers. - It should get round the GPL can of worms. Greg -- See complete headers for address and phone numbers. --Q0rSlbzrZN6k9QnT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQFGIw6/IubykFB6QiMRAu1IAJ9YmntQcsmlredaM315gRjPeoKevgCgmYdw m3obtP6kjSNmr8cujN707Hg= =ec3O -----END PGP SIGNATURE----- --Q0rSlbzrZN6k9QnT--