Re: usbtv driver port (questions)

2016-05-25 Thread patrick keshishian
On Wed, May 25, 2016 at 01:57:36PM +0200, Marcus Glocker wrote:
> On Tue, May 24, 2016 at 04:46:57PM -0700, patrick keshishian wrote:
> 
> > Hi,
> > 
> > I have a "mostly working" driver port for Fushicai Audio-Video
> > Grabber (vendor 0x1b71 product 0x3002).
> > 
> > I've had the video bit working for a few days on amd64 and macppc.
> > I finally managed to get the audio bit working this morning on
> > amd64, but still an encoding issue (LE vs BE) on macppc.
> > 
> > I'd like to "polish up" the code for a post here, or off-list if
> > that is preferred, for review and ridicule. So I have some
> > questions which I don't think style(9) answers.
> > 
> > 1. Types: Original source used a few instances of "u16" types,
> >but I think OpenBSD prefers "u_int16_t" and "uint16_t".
> >Which to pick?
> 
> I vote for uint*_t.
>  
> > 2. Return values inside parenthesis or not?
> 
> The ongoing religious question :-)  Some people say return and sizeof
> shouldn't be used with parenthesis because they are no functions.  I
> still find it more readable with parenthesis.  We have both variations
> in the tree.  Your choice.
> 
> > 3. Original source filenames were hyphenated (e.g., usbtv-video.c).
> >OK to use underscore instead? I think it is preferred.
> >(Next question may trump this one)
> 
> How's about something a bit shorter, like uvcap.c (USB Video Capture)
> and then also call the driver uvcap?  Anyway just a proposal.  Otherwise
> yes, replace the '-' by '_' in the filename.
> 
> > 4. Original source has three .c and one .h file. They are dual-
> >licensed Linux sources: BSD and GPL.
> > 
> >I've borrowed from uvideo.c to get this driver working,
> >introducing a fourth .c.
> > 
> >I'm pretty sure OBSD doesn't want so many files introduced.
> >Should I combine the original .c files into one .c file, keep
> >the .h and the new .c file I introduced? Maintaining copyright
> >notices as-is (the original and one from uvideo.c).
> 
> For such a kind of driver I also would perfer one .c and one .h file.

Yes. Only concern I have is the slight variations in license
text. The original code is a two-clause BSD[0] while the uvideo.c
is the far simpler one.

> > 5. If tech@ is not the place to post an initial port effort,
> >especially from a first-timer, do let me know.
> 
> Well, I think tech@ is the right place.  Maybe we can take some stuff
> off-list.  Though myself has no such device yet to test further.

It is a low-end item, so I'm not sure if you really want one, but
would be glad to send one your way; just let me know where to ship
it to.

Also thanks for the suggestions!

--patrick

[0] https://github.com/torvalds/linux/tree/master/drivers/media/usb/usbtv



Re: usbtv driver port (questions)

2016-05-25 Thread patrick keshishian
On Wed, May 25, 2016 at 08:45:29AM -0400, Ian Darwin wrote:
> On 2016-05-25 7:57 AM, Marcus Glocker wrote:
> >On Tue, May 24, 2016 at 04:46:57PM -0700, patrick keshishian wrote:
> >
> >>Hi,
> >>
> >>I have a "mostly working" driver port for Fushicai Audio-Video
> >>Grabber (vendor 0x1b71 product 0x3002).
> >>
> >>I've had the video bit working for a few days on amd64 and macppc.
> >>I finally managed to get the audio bit working this morning on
> >>amd64, but still an encoding issue (LE vs BE) on macppc.
> >>
> >>...
> >>2. Return values inside parenthesis or not?
> >The ongoing religious question :-)  Some people say return and sizeof
> >shouldn't be used with parenthesis because they are not functions.  I
> >still find it more readable with parenthesis.  We have both variations
> >in the tree.  Your choice.
> "Obviously without" :-)
> >
> >>3. Original source filenames were hyphenated (e.g., usbtv-video.c).
> >>OK to use underscore instead? I think it is preferred.
> >>(Next question may trump this one)
> >How's about something a bit shorter, like uvcap.c (USB Video Capture)
> >and then also call the driver uvcap?  Anyway just a proposal.  Otherwise
> >yes, replace the '-' by '_' in the filename.
> >
> >
> There are (at least) three other popular usb video capture devices with
> totally different chipsets (Syntek, Empia, Somagic, besides this Fushicai
> one, "usbtv007"), so calling one of them uvcap might be annoying, like if
> one of our many network drivers were called "network". See
> https://linuxtv.org/wiki/index.php/Easycap.
> Does it make sense to start a naming convention like: utvsyn, utvemp,
> utvsom, utvfu, ...?

I like this scheme and utvfu.

Thanks,
--patrick



Re: usbtv driver port (questions)

2016-05-25 Thread Artturi Alm
On Wed, May 25, 2016 at 08:45:29AM -0400, Ian Darwin wrote:
> On 2016-05-25 7:57 AM, Marcus Glocker wrote:
> > On Tue, May 24, 2016 at 04:46:57PM -0700, patrick keshishian wrote:
> > 
> > > Hi,
> > > 
> > > I have a "mostly working" driver port for Fushicai Audio-Video
> > > Grabber (vendor 0x1b71 product 0x3002).
> > > 
> > > I've had the video bit working for a few days on amd64 and macppc.
> > > I finally managed to get the audio bit working this morning on
> > > amd64, but still an encoding issue (LE vs BE) on macppc.
> > > 
> > > ...
> > > 2. Return values inside parenthesis or not?
> > The ongoing religious question :-)  Some people say return and sizeof
> > shouldn't be used with parenthesis because they are not functions.  I
> > still find it more readable with parenthesis.  We have both variations
> > in the tree.  Your choice.
> "Obviously without" :-)
> > 
> > > 3. Original source filenames were hyphenated (e.g., usbtv-video.c).
> > > OK to use underscore instead? I think it is preferred.
> > > (Next question may trump this one)
> > How's about something a bit shorter, like uvcap.c (USB Video Capture)
> > and then also call the driver uvcap?  Anyway just a proposal.  Otherwise
> > yes, replace the '-' by '_' in the filename.
> > 
> > 
> There are (at least) three other popular usb video capture devices with
> totally different chipsets (Syntek, Empia, Somagic, besides this Fushicai
> one, "usbtv007"), so calling one of them uvcap might be annoying, like if
> one of our many network drivers were called "network". See
> https://linuxtv.org/wiki/index.php/Easycap.
> Does it make sense to start a naming convention like: utvsyn, utvemp,
> utvsom, utvfu, ...?
> 
> Myself I own a Syntek one, which is why I'm aware of this issue:
>  port 4 addr 3: high speed, power 500 mA, config 1, USB 2.0 Video Capture
> Controller(0x0408), Syntek Semiconductor(0x05e1), rev 0.05
> 

fwiw. i still have a few "Somagic, Inc. SM-USB 007", for which i have planned
to revive a driver i came up with years ago, when iirc. usb stack was still
missing something needed to support it completely. would vote for utvsom,.. 

-Artturi



Re: usbtv driver port (questions)

2016-05-25 Thread Ian Darwin

On 2016-05-25 7:57 AM, Marcus Glocker wrote:

On Tue, May 24, 2016 at 04:46:57PM -0700, patrick keshishian wrote:


Hi,

I have a "mostly working" driver port for Fushicai Audio-Video
Grabber (vendor 0x1b71 product 0x3002).

I've had the video bit working for a few days on amd64 and macppc.
I finally managed to get the audio bit working this morning on
amd64, but still an encoding issue (LE vs BE) on macppc.

...
2. Return values inside parenthesis or not?

The ongoing religious question :-)  Some people say return and sizeof
shouldn't be used with parenthesis because they are not functions.  I
still find it more readable with parenthesis.  We have both variations
in the tree.  Your choice.

"Obviously without" :-)



3. Original source filenames were hyphenated (e.g., usbtv-video.c).
OK to use underscore instead? I think it is preferred.
(Next question may trump this one)

How's about something a bit shorter, like uvcap.c (USB Video Capture)
and then also call the driver uvcap?  Anyway just a proposal.  Otherwise
yes, replace the '-' by '_' in the filename.


There are (at least) three other popular usb video capture devices with 
totally different chipsets (Syntek, Empia, Somagic, besides this 
Fushicai one, "usbtv007"), so calling one of them uvcap might be 
annoying, like if one of our many network drivers were called "network". 
See https://linuxtv.org/wiki/index.php/Easycap.
Does it make sense to start a naming convention like: utvsyn, utvemp, 
utvsom, utvfu, ...?


Myself I own a Syntek one, which is why I'm aware of this issue:
 port 4 addr 3: high speed, power 500 mA, config 1, USB 2.0 Video 
Capture Controller(0x0408), Syntek Semiconductor(0x05e1), rev 0.05




Re: usbtv driver port (questions)

2016-05-25 Thread Marcus Glocker
On Tue, May 24, 2016 at 04:46:57PM -0700, patrick keshishian wrote:

> Hi,
> 
> I have a "mostly working" driver port for Fushicai Audio-Video
> Grabber (vendor 0x1b71 product 0x3002).
> 
> I've had the video bit working for a few days on amd64 and macppc.
> I finally managed to get the audio bit working this morning on
> amd64, but still an encoding issue (LE vs BE) on macppc.
> 
> I'd like to "polish up" the code for a post here, or off-list if
> that is preferred, for review and ridicule. So I have some
> questions which I don't think style(9) answers.
> 
> 1. Types: Original source used a few instances of "u16" types,
>but I think OpenBSD prefers "u_int16_t" and "uint16_t".
>Which to pick?

I vote for uint*_t.
 
> 2. Return values inside parenthesis or not?

The ongoing religious question :-)  Some people say return and sizeof
shouldn't be used with parenthesis because they are no functions.  I
still find it more readable with parenthesis.  We have both variations
in the tree.  Your choice.

> 3. Original source filenames were hyphenated (e.g., usbtv-video.c).
>OK to use underscore instead? I think it is preferred.
>(Next question may trump this one)

How's about something a bit shorter, like uvcap.c (USB Video Capture)
and then also call the driver uvcap?  Anyway just a proposal.  Otherwise
yes, replace the '-' by '_' in the filename.

> 4. Original source has three .c and one .h file. They are dual-
>licensed Linux sources: BSD and GPL.
> 
>I've borrowed from uvideo.c to get this driver working,
>introducing a fourth .c.
> 
>I'm pretty sure OBSD doesn't want so many files introduced.
>Should I combine the original .c files into one .c file, keep
>the .h and the new .c file I introduced? Maintaining copyright
>notices as-is (the original and one from uvideo.c).

For such a kind of driver I also would perfer one .c and one .h file.
 
> 5. If tech@ is not the place to post an initial port effort,
>especially from a first-timer, do let me know.

Well, I think tech@ is the right place.  Maybe we can take some stuff
off-list.  Though myself has no such device yet to test further.



usbtv driver port (questions)

2016-05-24 Thread patrick keshishian
Hi,

I have a "mostly working" driver port for Fushicai Audio-Video
Grabber (vendor 0x1b71 product 0x3002).

I've had the video bit working for a few days on amd64 and macppc.
I finally managed to get the audio bit working this morning on
amd64, but still an encoding issue (LE vs BE) on macppc.

I'd like to "polish up" the code for a post here, or off-list if
that is preferred, for review and ridicule. So I have some
questions which I don't think style(9) answers.

1. Types: Original source used a few instances of "u16" types,
   but I think OpenBSD prefers "u_int16_t" and "uint16_t".
   Which to pick?

2. Return values inside parenthesis or not?

3. Original source filenames were hyphenated (e.g., usbtv-video.c).
   OK to use underscore instead? I think it is preferred.
   (Next question may trump this one)

4. Original source has three .c and one .h file. They are dual-
   licensed Linux sources: BSD and GPL.

   I've borrowed from uvideo.c to get this driver working,
   introducing a fourth .c.

   I'm pretty sure OBSD doesn't want so many files introduced.
   Should I combine the original .c files into one .c file, keep
   the .h and the new .c file I introduced? Maintaining copyright
   notices as-is (the original and one from uvideo.c).

5. If tech@ is not the place to post an initial port effort,
   especially from a first-timer, do let me know.

Thanks,
--patrick