Commit 1dc6e418 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging: easycap: drop redunant backslashes from the code

remove \ from the code where C syntex doesnt require it
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2a9a05c4
...@@ -384,9 +384,9 @@ int video_eof; ...@@ -384,9 +384,9 @@ int video_eof;
int video_junk; int video_junk;
struct data_buffer video_isoc_buffer[VIDEO_ISOC_BUFFER_MANY]; struct data_buffer video_isoc_buffer[VIDEO_ISOC_BUFFER_MANY];
struct data_buffer \ struct data_buffer
field_buffer[FIELD_BUFFER_MANY][(FIELD_BUFFER_SIZE/PAGE_SIZE)]; field_buffer[FIELD_BUFFER_MANY][(FIELD_BUFFER_SIZE/PAGE_SIZE)];
struct data_buffer \ struct data_buffer
frame_buffer[FRAME_BUFFER_MANY][(FRAME_BUFFER_SIZE/PAGE_SIZE)]; frame_buffer[FRAME_BUFFER_MANY][(FRAME_BUFFER_SIZE/PAGE_SIZE)];
struct list_head urb_video_head; struct list_head urb_video_head;
...@@ -518,9 +518,9 @@ struct data_buffer audio_buffer[]; ...@@ -518,9 +518,9 @@ struct data_buffer audio_buffer[];
void easycap_complete(struct urb *); void easycap_complete(struct urb *);
int easycap_open(struct inode *, struct file *); int easycap_open(struct inode *, struct file *);
int easycap_release(struct inode *, struct file *); int easycap_release(struct inode *, struct file *);
long easycap_ioctl_noinode(struct file *, unsigned int, \ long easycap_ioctl_noinode(struct file *, unsigned int,
unsigned long); unsigned long);
int easycap_ioctl(struct inode *, struct file *, unsigned int, \ int easycap_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#if defined(EASYCAP_IS_VIDEODEV_CLIENT) #if defined(EASYCAP_IS_VIDEODEV_CLIENT)
...@@ -532,7 +532,7 @@ int videodev_release(struct video_device *); ...@@ -532,7 +532,7 @@ int videodev_release(struct video_device *);
unsigned int easycap_poll(struct file *, poll_table *); unsigned int easycap_poll(struct file *, poll_table *);
int easycap_mmap(struct file *, struct vm_area_struct *); int easycap_mmap(struct file *, struct vm_area_struct *);
int easycap_usb_probe(struct usb_interface *, \ int easycap_usb_probe(struct usb_interface *,
const struct usb_device_id *); const struct usb_device_id *);
void easycap_usb_disconnect(struct usb_interface *); void easycap_usb_disconnect(struct usb_interface *);
void easycap_delete(struct kref *); void easycap_delete(struct kref *);
...@@ -544,14 +544,14 @@ int easycap_dqbuf(struct easycap *, int); ...@@ -544,14 +544,14 @@ int easycap_dqbuf(struct easycap *, int);
int submit_video_urbs(struct easycap *); int submit_video_urbs(struct easycap *);
int kill_video_urbs(struct easycap *); int kill_video_urbs(struct easycap *);
int field2frame(struct easycap *); int field2frame(struct easycap *);
int redaub(struct easycap *, void *, void *, \ int redaub(struct easycap *, void *, void *,
int, int, __u8, __u8, bool); int, int, __u8, __u8, bool);
void easycap_testcard(struct easycap *, int); void easycap_testcard(struct easycap *, int);
int fillin_formats(void); int fillin_formats(void);
int reset(struct easycap *); int reset(struct easycap *);
int newinput(struct easycap *, int); int newinput(struct easycap *, int);
int adjust_standard(struct easycap *, v4l2_std_id); int adjust_standard(struct easycap *, v4l2_std_id);
int adjust_format(struct easycap *, __u32, __u32, __u32, \ int adjust_format(struct easycap *, __u32, __u32, __u32,
int, bool); int, bool);
int adjust_brightness(struct easycap *, int); int adjust_brightness(struct easycap *, int);
int adjust_contrast(struct easycap *, int); int adjust_contrast(struct easycap *, int);
...@@ -569,15 +569,14 @@ int easycap_alsa_probe(struct easycap *); ...@@ -569,15 +569,14 @@ int easycap_alsa_probe(struct easycap *);
void easycap_alsa_complete(struct urb *); void easycap_alsa_complete(struct urb *);
int easycap_alsa_open(struct snd_pcm_substream *); int easycap_alsa_open(struct snd_pcm_substream *);
int easycap_alsa_close(struct snd_pcm_substream *); int easycap_alsa_close(struct snd_pcm_substream *);
int easycap_alsa_hw_params(struct snd_pcm_substream *, \ int easycap_alsa_hw_params(struct snd_pcm_substream *,
struct snd_pcm_hw_params *); struct snd_pcm_hw_params *);
int easycap_alsa_vmalloc(struct snd_pcm_substream *, size_t); int easycap_alsa_vmalloc(struct snd_pcm_substream *, size_t);
int easycap_alsa_hw_free(struct snd_pcm_substream *); int easycap_alsa_hw_free(struct snd_pcm_substream *);
int easycap_alsa_prepare(struct snd_pcm_substream *); int easycap_alsa_prepare(struct snd_pcm_substream *);
int easycap_alsa_ack(struct snd_pcm_substream *); int easycap_alsa_ack(struct snd_pcm_substream *);
int easycap_alsa_trigger(struct snd_pcm_substream *, int); int easycap_alsa_trigger(struct snd_pcm_substream *, int);
snd_pcm_uframes_t \ snd_pcm_uframes_t easycap_alsa_pointer(struct snd_pcm_substream *);
easycap_alsa_pointer(struct snd_pcm_substream *);
struct page *easycap_alsa_page(struct snd_pcm_substream *, unsigned long); struct page *easycap_alsa_page(struct snd_pcm_substream *, unsigned long);
#else #else
...@@ -585,9 +584,9 @@ void easyoss_complete(struct urb *); ...@@ -585,9 +584,9 @@ void easyoss_complete(struct urb *);
ssize_t easyoss_read(struct file *, char __user *, size_t, loff_t *); ssize_t easyoss_read(struct file *, char __user *, size_t, loff_t *);
int easyoss_open(struct inode *, struct file *); int easyoss_open(struct inode *, struct file *);
int easyoss_release(struct inode *, struct file *); int easyoss_release(struct inode *, struct file *);
long easyoss_ioctl_noinode(struct file *, unsigned int, \ long easyoss_ioctl_noinode(struct file *, unsigned int,
unsigned long); unsigned long);
int easyoss_ioctl(struct inode *, struct file *, unsigned int, \ int easyoss_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
unsigned int easyoss_poll(struct file *, poll_table *); unsigned int easyoss_poll(struct file *, poll_table *);
void easyoss_delete(struct kref *); void easyoss_delete(struct kref *);
...@@ -619,7 +618,7 @@ int ready_saa(struct usb_device *); ...@@ -619,7 +618,7 @@ int ready_saa(struct usb_device *);
int merit_saa(struct usb_device *); int merit_saa(struct usb_device *);
int check_vt(struct usb_device *); int check_vt(struct usb_device *);
int select_input(struct usb_device *, int, int); int select_input(struct usb_device *, int, int);
int set_resolution(struct usb_device *, \ int set_resolution(struct usb_device *,
__u16, __u16, __u16, __u16); __u16, __u16, __u16, __u16);
int read_saa(struct usb_device *, __u16); int read_saa(struct usb_device *, __u16);
......
...@@ -72,13 +72,13 @@ if (0xFFFF == peasycap_standard->mask) { ...@@ -72,13 +72,13 @@ if (0xFFFF == peasycap_standard->mask) {
} }
} }
if (0xFFFF == peasycap_standard->mask) { if (0xFFFF == peasycap_standard->mask) {
SAM("ERROR: 0x%08X=std_id: standard not found\n", \ SAM("ERROR: 0x%08X=std_id: standard not found\n",
(unsigned int)std_id); (unsigned int)std_id);
return -EINVAL; return -EINVAL;
} }
SAM("selected standard: %s\n", \ SAM("selected standard: %s\n",
&(peasycap_standard->v4l2_standard.name[0])); &(peasycap_standard->v4l2_standard.name[0]));
if (peasycap->standard_offset == \ if (peasycap->standard_offset ==
(int)(peasycap_standard - &easycap_standard[0])) { (int)(peasycap_standard - &easycap_standard[0])) {
SAM("requested standard already in effect\n"); SAM("requested standard already in effect\n");
return 0; return 0;
...@@ -86,17 +86,17 @@ if (peasycap->standard_offset == \ ...@@ -86,17 +86,17 @@ if (peasycap->standard_offset == \
peasycap->standard_offset = (int)(peasycap_standard - &easycap_standard[0]); peasycap->standard_offset = (int)(peasycap_standard - &easycap_standard[0]);
for (k = 0; k < INPUT_MANY; k++) { for (k = 0; k < INPUT_MANY; k++) {
if (!peasycap->inputset[k].standard_offset_ok) { if (!peasycap->inputset[k].standard_offset_ok) {
peasycap->inputset[k].standard_offset = \ peasycap->inputset[k].standard_offset =
peasycap->standard_offset; peasycap->standard_offset;
} }
} }
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) { if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
peasycap->inputset[peasycap->input].standard_offset = \ peasycap->inputset[peasycap->input].standard_offset =
peasycap->standard_offset; peasycap->standard_offset;
peasycap->inputset[peasycap->input].standard_offset_ok = 1; peasycap->inputset[peasycap->input].standard_offset_ok = 1;
} else } else
JOM(8, "%i=peasycap->input\n", peasycap->input); JOM(8, "%i=peasycap->input\n", peasycap->input);
peasycap->fps = peasycap_standard->v4l2_standard.frameperiod.denominator / \ peasycap->fps = peasycap_standard->v4l2_standard.frameperiod.denominator /
peasycap_standard->v4l2_standard.frameperiod.numerator; peasycap_standard->v4l2_standard.frameperiod.numerator;
switch (peasycap->fps) { switch (peasycap->fps) {
case 6: case 6:
...@@ -145,15 +145,15 @@ case NTSC_M_JP: { ...@@ -145,15 +145,15 @@ case NTSC_M_JP: {
itwas = (unsigned int)ir; itwas = (unsigned int)ir;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (0 != rc)
SAM("ERROR: failed to set SAA register " \ SAM("ERROR: failed to set SAA register "
"0x%02X to 0x%02X for JP standard\n", reg, set); "0x%02X to 0x%02X for JP standard\n", reg, set);
else { else {
isnow = (unsigned int)read_saa(peasycap->pusb_device, reg); isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
if (0 > ir) if (0 > ir)
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"to 0x%02X\n", reg, isnow); "to 0x%02X\n", reg, isnow);
else else
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"from 0x%02X to 0x%02X\n", reg, itwas, isnow); "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
} }
...@@ -165,15 +165,15 @@ case NTSC_M_JP: { ...@@ -165,15 +165,15 @@ case NTSC_M_JP: {
itwas = (unsigned int)ir; itwas = (unsigned int)ir;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (0 != rc)
SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X " \ SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X "
"for JP standard\n", reg, set); "for JP standard\n", reg, set);
else { else {
isnow = (unsigned int)read_saa(peasycap->pusb_device, reg); isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
if (0 > ir) if (0 > ir)
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"to 0x%02X\n", reg, isnow); "to 0x%02X\n", reg, isnow);
else else
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"from 0x%02X to 0x%02X\n", reg, itwas, isnow); "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
...@@ -213,15 +213,15 @@ if (need) { ...@@ -213,15 +213,15 @@ if (need) {
itwas = (unsigned int)ir; itwas = (unsigned int)ir;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != write_saa(peasycap->pusb_device, reg, set)) { if (0 != write_saa(peasycap->pusb_device, reg, set)) {
SAM("ERROR: failed to set SAA register " \ SAM("ERROR: failed to set SAA register "
"0x%02X to 0x%02X for table 42\n", reg, set); "0x%02X to 0x%02X for table 42\n", reg, set);
} else { } else {
isnow = (unsigned int)read_saa(peasycap->pusb_device, reg); isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
if (0 > ir) if (0 > ir)
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"to 0x%02X\n", reg, isnow); "to 0x%02X\n", reg, isnow);
else else
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"from 0x%02X to 0x%02X\n", reg, itwas, isnow); "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
} }
} }
...@@ -233,7 +233,7 @@ if (need) { ...@@ -233,7 +233,7 @@ if (need) {
reg = 0x08; reg = 0x08;
ir = read_saa(peasycap->pusb_device, reg); ir = read_saa(peasycap->pusb_device, reg);
if (0 > ir) if (0 > ir)
SAM("ERROR: failed to read SAA register 0x%02X " \ SAM("ERROR: failed to read SAA register 0x%02X "
"so cannot reset\n", reg); "so cannot reset\n", reg);
else { else {
itwas = (unsigned int)ir; itwas = (unsigned int)ir;
...@@ -243,15 +243,15 @@ else { ...@@ -243,15 +243,15 @@ else {
set = itwas & ~0x40 ; set = itwas & ~0x40 ;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (0 != rc)
SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", \ SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
reg, set); reg, set);
else { else {
isnow = (unsigned int)read_saa(peasycap->pusb_device, reg); isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
if (0 > ir) if (0 > ir)
JOM(8, "SAA register 0x%02X changed to 0x%02X\n", \ JOM(8, "SAA register 0x%02X changed to 0x%02X\n",
reg, isnow); reg, isnow);
else else
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"from 0x%02X to 0x%02X\n", reg, itwas, isnow); "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
} }
} }
...@@ -263,7 +263,7 @@ else { ...@@ -263,7 +263,7 @@ else {
reg = 0x40; reg = 0x40;
ir = read_saa(peasycap->pusb_device, reg); ir = read_saa(peasycap->pusb_device, reg);
if (0 > ir) if (0 > ir)
SAM("ERROR: failed to read SAA register 0x%02X " \ SAM("ERROR: failed to read SAA register 0x%02X "
"so cannot reset\n", reg); "so cannot reset\n", reg);
else { else {
itwas = (unsigned int)ir; itwas = (unsigned int)ir;
...@@ -273,15 +273,15 @@ else { ...@@ -273,15 +273,15 @@ else {
set = itwas & ~0x80 ; set = itwas & ~0x80 ;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (0 != rc)
SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", \ SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
reg, set); reg, set);
else { else {
isnow = (unsigned int)read_saa(peasycap->pusb_device, reg); isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
if (0 > ir) if (0 > ir)
JOM(8, "SAA register 0x%02X changed to 0x%02X\n", \ JOM(8, "SAA register 0x%02X changed to 0x%02X\n",
reg, isnow); reg, isnow);
else else
JOM(8, "SAA register 0x%02X changed " \ JOM(8, "SAA register 0x%02X changed "
"from 0x%02X to 0x%02X\n", reg, itwas, isnow); "from 0x%02X to 0x%02X\n", reg, itwas, isnow);
} }
} }
...@@ -300,7 +300,7 @@ if (0 > ir) ...@@ -300,7 +300,7 @@ if (0 > ir)
else else
set = 0x07 ; set = 0x07 ;
if (0 != write_saa(peasycap->pusb_device, reg, set)) if (0 != write_saa(peasycap->pusb_device, reg, set))
SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", \ SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
reg, set); reg, set);
else { else {
isnow = (unsigned int)read_saa(peasycap->pusb_device, reg); isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
...@@ -340,7 +340,7 @@ return 0; ...@@ -340,7 +340,7 @@ return 0;
* ERRORS RETURN A NEGATIVE NUMBER. * ERRORS RETURN A NEGATIVE NUMBER.
*/ */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
int adjust_format(struct easycap *peasycap, \ int adjust_format(struct easycap *peasycap,
__u32 width, __u32 height, __u32 pixelformat, int field, bool try) __u32 width, __u32 height, __u32 pixelformat, int field, bool try)
{ {
struct easycap_format *peasycap_format, *peasycap_best_format; struct easycap_format *peasycap_format, *peasycap_best_format;
...@@ -369,7 +369,7 @@ uc = pixelformat; ...@@ -369,7 +369,7 @@ uc = pixelformat;
memcpy((void *)pc, (void *)(&uc), 4); memcpy((void *)pc, (void *)(&uc), 4);
bf[4] = 0; bf[4] = 0;
mask = 0xFF & easycap_standard[peasycap->standard_offset].mask; mask = 0xFF & easycap_standard[peasycap->standard_offset].mask;
SAM("sought: %ix%i,%s(0x%08X),%i=field,0x%02X=std mask\n", \ SAM("sought: %ix%i,%s(0x%08X),%i=field,0x%02X=std mask\n",
width, height, pc, pixelformat, field, mask); width, height, pc, pixelformat, field, mask);
switch (field) { switch (field) {
case V4L2_FIELD_ANY: { case V4L2_FIELD_ANY: {
...@@ -425,18 +425,18 @@ if (V4L2_FIELD_ANY == field) { ...@@ -425,18 +425,18 @@ if (V4L2_FIELD_ANY == field) {
peasycap_best_format = (struct easycap_format *)NULL; peasycap_best_format = (struct easycap_format *)NULL;
peasycap_format = &easycap_format[0]; peasycap_format = &easycap_format[0];
while (0 != peasycap_format->v4l2_format.fmt.pix.width) { while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
JOM(16, ".> %i %i 0x%08X %ix%i\n", \ JOM(16, ".> %i %i 0x%08X %ix%i\n",
peasycap_format->mask & 0x01, peasycap_format->mask & 0x01,
peasycap_format->v4l2_format.fmt.pix.field, peasycap_format->v4l2_format.fmt.pix.field,
peasycap_format->v4l2_format.fmt.pix.pixelformat, peasycap_format->v4l2_format.fmt.pix.pixelformat,
peasycap_format->v4l2_format.fmt.pix.width, peasycap_format->v4l2_format.fmt.pix.width,
peasycap_format->v4l2_format.fmt.pix.height); peasycap_format->v4l2_format.fmt.pix.height);
if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) && \ if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
(peasycap_format->v4l2_format.fmt.pix.field == field) && \ (peasycap_format->v4l2_format.fmt.pix.field == field) &&
(peasycap_format->v4l2_format.fmt.pix.pixelformat == \ (peasycap_format->v4l2_format.fmt.pix.pixelformat ==
pixelformat) && \ pixelformat) &&
(peasycap_format->v4l2_format.fmt.pix.width == width) && \ (peasycap_format->v4l2_format.fmt.pix.width == width) &&
(peasycap_format->v4l2_format.fmt.pix.height == height)) { (peasycap_format->v4l2_format.fmt.pix.height == height)) {
peasycap_best_format = peasycap_format; peasycap_best_format = peasycap_format;
break; break;
...@@ -444,16 +444,16 @@ while (0 != peasycap_format->v4l2_format.fmt.pix.width) { ...@@ -444,16 +444,16 @@ while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
peasycap_format++; peasycap_format++;
} }
if (0 == peasycap_format->v4l2_format.fmt.pix.width) { if (0 == peasycap_format->v4l2_format.fmt.pix.width) {
SAM("cannot do: %ix%i with standard mask 0x%02X\n", \ SAM("cannot do: %ix%i with standard mask 0x%02X\n",
width, height, mask); width, height, mask);
peasycap_format = &easycap_format[0]; best = -1; peasycap_format = &easycap_format[0]; best = -1;
while (0 != peasycap_format->v4l2_format.fmt.pix.width) { while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) && \ if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
(peasycap_format->v4l2_format.fmt.pix\ (peasycap_format->v4l2_format.fmt.pix
.field == field) && \ .field == field) &&
(peasycap_format->v4l2_format.fmt.pix\ (peasycap_format->v4l2_format.fmt.pix
.pixelformat == pixelformat)) { .pixelformat == pixelformat)) {
miss = abs(peasycap_format->\ miss = abs(peasycap_format->
v4l2_format.fmt.pix.width - width); v4l2_format.fmt.pix.width - width);
if ((best > miss) || (best < 0)) { if ((best > miss) || (best < 0)) {
best = miss; best = miss;
...@@ -465,9 +465,9 @@ if (0 == peasycap_format->v4l2_format.fmt.pix.width) { ...@@ -465,9 +465,9 @@ if (0 == peasycap_format->v4l2_format.fmt.pix.width) {
peasycap_format++; peasycap_format++;
} }
if (-1 == best) { if (-1 == best) {
SAM("cannot do %ix... with standard mask 0x%02X\n", \ SAM("cannot do %ix... with standard mask 0x%02X\n",
width, mask); width, mask);
SAM("cannot do ...x%i with standard mask 0x%02X\n", \ SAM("cannot do ...x%i with standard mask 0x%02X\n",
height, mask); height, mask);
SAM(" %ix%i unmatched\n", width, height); SAM(" %ix%i unmatched\n", width, height);
return peasycap->format_offset; return peasycap->format_offset;
...@@ -488,8 +488,8 @@ if (false != try) { ...@@ -488,8 +488,8 @@ if (false != try) {
SAM("MISTAKE: true==try where is should be false\n"); SAM("MISTAKE: true==try where is should be false\n");
return -EINVAL; return -EINVAL;
} }
SAM("actioning: %ix%i %s\n", \ SAM("actioning: %ix%i %s\n",
peasycap_format->v4l2_format.fmt.pix.width, \ peasycap_format->v4l2_format.fmt.pix.width,
peasycap_format->v4l2_format.fmt.pix.height, peasycap_format->v4l2_format.fmt.pix.height,
&peasycap_format->name[0]); &peasycap_format->name[0]);
peasycap->height = peasycap_format->v4l2_format.fmt.pix.height; peasycap->height = peasycap_format->v4l2_format.fmt.pix.height;
...@@ -500,12 +500,12 @@ peasycap->format_offset = (int)(peasycap_format - &easycap_format[0]); ...@@ -500,12 +500,12 @@ peasycap->format_offset = (int)(peasycap_format - &easycap_format[0]);
for (k = 0; k < INPUT_MANY; k++) { for (k = 0; k < INPUT_MANY; k++) {
if (!peasycap->inputset[k].format_offset_ok) { if (!peasycap->inputset[k].format_offset_ok) {
peasycap->inputset[k].format_offset = \ peasycap->inputset[k].format_offset =
peasycap->format_offset; peasycap->format_offset;
} }
} }
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) { if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
peasycap->inputset[peasycap->input].format_offset = \ peasycap->inputset[peasycap->input].format_offset =
peasycap->format_offset; peasycap->format_offset;
peasycap->inputset[peasycap->input].format_offset_ok = 1; peasycap->inputset[peasycap->input].format_offset_ok = 1;
} else } else
...@@ -534,9 +534,9 @@ if (true == peasycap->decimatepixel) ...@@ -534,9 +534,9 @@ if (true == peasycap->decimatepixel)
multiplier = 2; multiplier = 2;
else else
multiplier = 1; multiplier = 1;
peasycap->videofieldamount = multiplier * peasycap->width * \ peasycap->videofieldamount = multiplier * peasycap->width *
multiplier * peasycap->height; multiplier * peasycap->height;
peasycap->frame_buffer_used = peasycap->bytesperpixel * \ peasycap->frame_buffer_used = peasycap->bytesperpixel *
peasycap->width * peasycap->height; peasycap->width * peasycap->height;
if (peasycap->video_isoc_streaming) { if (peasycap->video_isoc_streaming) {
resubmit = true; resubmit = true;
...@@ -549,29 +549,29 @@ if (peasycap->video_isoc_streaming) { ...@@ -549,29 +549,29 @@ if (peasycap->video_isoc_streaming) {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
if (0 == (0x01 & peasycap_format->mask)) { if (0 == (0x01 & peasycap_format->mask)) {
if (((720 == peasycap_format->v4l2_format.fmt.pix.width) && \ if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
(576 == \ (576 ==
peasycap_format->v4l2_format.fmt.pix.height)) || \ peasycap_format->v4l2_format.fmt.pix.height)) ||
((360 == \ ((360 ==
peasycap_format->v4l2_format.fmt.pix.width) && \ peasycap_format->v4l2_format.fmt.pix.width) &&
(288 == \ (288 ==
peasycap_format->v4l2_format.fmt.pix.height))) { peasycap_format->v4l2_format.fmt.pix.height))) {
if (0 != set_resolution(p, 0x0000, 0x0001, 0x05A0, 0x0121)) { if (0 != set_resolution(p, 0x0000, 0x0001, 0x05A0, 0x0121)) {
SAM("ERROR: set_resolution() failed\n"); SAM("ERROR: set_resolution() failed\n");
return -EINVAL; return -EINVAL;
} }
} else if ((704 == peasycap_format->v4l2_format.fmt.pix.width) && \ } else if ((704 == peasycap_format->v4l2_format.fmt.pix.width) &&
(576 == peasycap_format->v4l2_format.fmt.pix.height)) { (576 == peasycap_format->v4l2_format.fmt.pix.height)) {
if (0 != set_resolution(p, 0x0004, 0x0001, 0x0584, 0x0121)) { if (0 != set_resolution(p, 0x0004, 0x0001, 0x0584, 0x0121)) {
SAM("ERROR: set_resolution() failed\n"); SAM("ERROR: set_resolution() failed\n");
return -EINVAL; return -EINVAL;
} }
} else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) && \ } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
(480 == \ (480 ==
peasycap_format->v4l2_format.fmt.pix.height)) || \ peasycap_format->v4l2_format.fmt.pix.height)) ||
((320 == \ ((320 ==
peasycap_format->v4l2_format.fmt.pix.width) && \ peasycap_format->v4l2_format.fmt.pix.width) &&
(240 == \ (240 ==
peasycap_format->v4l2_format.fmt.pix.height))) { peasycap_format->v4l2_format.fmt.pix.height))) {
if (0 != set_resolution(p, 0x0014, 0x0020, 0x0514, 0x0110)) { if (0 != set_resolution(p, 0x0014, 0x0020, 0x0514, 0x0110)) {
SAM("ERROR: set_resolution() failed\n"); SAM("ERROR: set_resolution() failed\n");
...@@ -587,23 +587,23 @@ if (0 == (0x01 & peasycap_format->mask)) { ...@@ -587,23 +587,23 @@ if (0 == (0x01 & peasycap_format->mask)) {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
} else { } else {
if (((720 == peasycap_format->v4l2_format.fmt.pix.width) && \ if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
(480 == \ (480 ==
peasycap_format->v4l2_format.fmt.pix.height)) || \ peasycap_format->v4l2_format.fmt.pix.height)) ||
((360 == \ ((360 ==
peasycap_format->v4l2_format.fmt.pix.width) && \ peasycap_format->v4l2_format.fmt.pix.width) &&
(240 == \ (240 ==
peasycap_format->v4l2_format.fmt.pix.height))) { peasycap_format->v4l2_format.fmt.pix.height))) {
if (0 != set_resolution(p, 0x0000, 0x0003, 0x05A0, 0x00F3)) { if (0 != set_resolution(p, 0x0000, 0x0003, 0x05A0, 0x00F3)) {
SAM("ERROR: set_resolution() failed\n"); SAM("ERROR: set_resolution() failed\n");
return -EINVAL; return -EINVAL;
} }
} else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) && \ } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
(480 == \ (480 ==
peasycap_format->v4l2_format.fmt.pix.height)) || \ peasycap_format->v4l2_format.fmt.pix.height)) ||
((320 == \ ((320 ==
peasycap_format->v4l2_format.fmt.pix.width) && \ peasycap_format->v4l2_format.fmt.pix.width) &&
(240 == \ (240 ==
peasycap_format->v4l2_format.fmt.pix.height))) { peasycap_format->v4l2_format.fmt.pix.height))) {
if (0 != set_resolution(p, 0x0014, 0x0003, 0x0514, 0x00F3)) { if (0 != set_resolution(p, 0x0014, 0x0003, 0x0514, 0x00F3)) {
SAM("ERROR: set_resolution() failed\n"); SAM("ERROR: set_resolution() failed\n");
...@@ -636,15 +636,15 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) { ...@@ -636,15 +636,15 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) {
i1 = 0; i1 = 0;
while (0xFFFFFFFF != easycap_control[i1].id) { while (0xFFFFFFFF != easycap_control[i1].id) {
if (V4L2_CID_BRIGHTNESS == easycap_control[i1].id) { if (V4L2_CID_BRIGHTNESS == easycap_control[i1].id) {
if ((easycap_control[i1].minimum > value) || \ if ((easycap_control[i1].minimum > value) ||
(easycap_control[i1].maximum < value)) (easycap_control[i1].maximum < value))
value = easycap_control[i1].default_value; value = easycap_control[i1].default_value;
if ((easycap_control[i1].minimum <= peasycap->brightness) && \ if ((easycap_control[i1].minimum <= peasycap->brightness) &&
(easycap_control[i1].maximum >= \ (easycap_control[i1].maximum >=
peasycap->brightness)) { peasycap->brightness)) {
if (peasycap->brightness == value) { if (peasycap->brightness == value) {
SAM("unchanged brightness at 0x%02X\n", \ SAM("unchanged brightness at 0x%02X\n",
value); value);
return 0; return 0;
} }
...@@ -652,11 +652,11 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -652,11 +652,11 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
peasycap->brightness = value; peasycap->brightness = value;
for (k = 0; k < INPUT_MANY; k++) { for (k = 0; k < INPUT_MANY; k++) {
if (!peasycap->inputset[k].brightness_ok) if (!peasycap->inputset[k].brightness_ok)
peasycap->inputset[k].brightness = \ peasycap->inputset[k].brightness =
peasycap->brightness; peasycap->brightness;
} }
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) { if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
peasycap->inputset[peasycap->input].brightness = \ peasycap->inputset[peasycap->input].brightness =
peasycap->brightness; peasycap->brightness;
peasycap->inputset[peasycap->input].brightness_ok = 1; peasycap->inputset[peasycap->input].brightness_ok = 1;
} else } else
...@@ -666,7 +666,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -666,7 +666,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
SAM("adjusting brightness to 0x%02X\n", mood); SAM("adjusting brightness to 0x%02X\n", mood);
return 0; return 0;
} else { } else {
SAM("WARNING: failed to adjust brightness " \ SAM("WARNING: failed to adjust brightness "
"to 0x%02X\n", mood); "to 0x%02X\n", mood);
return -ENOENT; return -ENOENT;
} }
...@@ -694,14 +694,14 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) { ...@@ -694,14 +694,14 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) {
i1 = 0; i1 = 0;
while (0xFFFFFFFF != easycap_control[i1].id) { while (0xFFFFFFFF != easycap_control[i1].id) {
if (V4L2_CID_CONTRAST == easycap_control[i1].id) { if (V4L2_CID_CONTRAST == easycap_control[i1].id) {
if ((easycap_control[i1].minimum > value) || \ if ((easycap_control[i1].minimum > value) ||
(easycap_control[i1].maximum < value)) (easycap_control[i1].maximum < value))
value = easycap_control[i1].default_value; value = easycap_control[i1].default_value;
if ((easycap_control[i1].minimum <= peasycap->contrast) && \ if ((easycap_control[i1].minimum <= peasycap->contrast) &&
(easycap_control[i1].maximum >= \ (easycap_control[i1].maximum >=
peasycap->contrast)) { peasycap->contrast)) {
if (peasycap->contrast == value) { if (peasycap->contrast == value) {
SAM("unchanged contrast at 0x%02X\n", value); SAM("unchanged contrast at 0x%02X\n", value);
...@@ -711,12 +711,12 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -711,12 +711,12 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
peasycap->contrast = value; peasycap->contrast = value;
for (k = 0; k < INPUT_MANY; k++) { for (k = 0; k < INPUT_MANY; k++) {
if (!peasycap->inputset[k].contrast_ok) { if (!peasycap->inputset[k].contrast_ok) {
peasycap->inputset[k].contrast = \ peasycap->inputset[k].contrast =
peasycap->contrast; peasycap->contrast;
} }
} }
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) { if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
peasycap->inputset[peasycap->input].contrast = \ peasycap->inputset[peasycap->input].contrast =
peasycap->contrast; peasycap->contrast;
peasycap->inputset[peasycap->input].contrast_ok = 1; peasycap->inputset[peasycap->input].contrast_ok = 1;
} else } else
...@@ -726,7 +726,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -726,7 +726,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
SAM("adjusting contrast to 0x%02X\n", mood); SAM("adjusting contrast to 0x%02X\n", mood);
return 0; return 0;
} else { } else {
SAM("WARNING: failed to adjust contrast to " \ SAM("WARNING: failed to adjust contrast to "
"0x%02X\n", mood); "0x%02X\n", mood);
return -ENOENT; return -ENOENT;
} }
...@@ -754,16 +754,16 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) { ...@@ -754,16 +754,16 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) {
i1 = 0; i1 = 0;
while (0xFFFFFFFF != easycap_control[i1].id) { while (0xFFFFFFFF != easycap_control[i1].id) {
if (V4L2_CID_SATURATION == easycap_control[i1].id) { if (V4L2_CID_SATURATION == easycap_control[i1].id) {
if ((easycap_control[i1].minimum > value) || \ if ((easycap_control[i1].minimum > value) ||
(easycap_control[i1].maximum < value)) (easycap_control[i1].maximum < value))
value = easycap_control[i1].default_value; value = easycap_control[i1].default_value;
if ((easycap_control[i1].minimum <= peasycap->saturation) && \ if ((easycap_control[i1].minimum <= peasycap->saturation) &&
(easycap_control[i1].maximum >= \ (easycap_control[i1].maximum >=
peasycap->saturation)) { peasycap->saturation)) {
if (peasycap->saturation == value) { if (peasycap->saturation == value) {
SAM("unchanged saturation at 0x%02X\n", \ SAM("unchanged saturation at 0x%02X\n",
value); value);
return 0; return 0;
} }
...@@ -771,12 +771,12 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -771,12 +771,12 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
peasycap->saturation = value; peasycap->saturation = value;
for (k = 0; k < INPUT_MANY; k++) { for (k = 0; k < INPUT_MANY; k++) {
if (!peasycap->inputset[k].saturation_ok) { if (!peasycap->inputset[k].saturation_ok) {
peasycap->inputset[k].saturation = \ peasycap->inputset[k].saturation =
peasycap->saturation; peasycap->saturation;
} }
} }
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) { if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
peasycap->inputset[peasycap->input].saturation = \ peasycap->inputset[peasycap->input].saturation =
peasycap->saturation; peasycap->saturation;
peasycap->inputset[peasycap->input].saturation_ok = 1; peasycap->inputset[peasycap->input].saturation_ok = 1;
} else } else
...@@ -786,7 +786,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -786,7 +786,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
SAM("adjusting saturation to 0x%02X\n", mood); SAM("adjusting saturation to 0x%02X\n", mood);
return 0; return 0;
} else { } else {
SAM("WARNING: failed to adjust saturation to " \ SAM("WARNING: failed to adjust saturation to "
"0x%02X\n", mood); "0x%02X\n", mood);
return -ENOENT; return -ENOENT;
} }
...@@ -814,12 +814,12 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) { ...@@ -814,12 +814,12 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) {
i1 = 0; i1 = 0;
while (0xFFFFFFFF != easycap_control[i1].id) { while (0xFFFFFFFF != easycap_control[i1].id) {
if (V4L2_CID_HUE == easycap_control[i1].id) { if (V4L2_CID_HUE == easycap_control[i1].id) {
if ((easycap_control[i1].minimum > value) || \ if ((easycap_control[i1].minimum > value) ||
(easycap_control[i1].maximum < value)) (easycap_control[i1].maximum < value))
value = easycap_control[i1].default_value; value = easycap_control[i1].default_value;
if ((easycap_control[i1].minimum <= peasycap->hue) && \ if ((easycap_control[i1].minimum <= peasycap->hue) &&
(easycap_control[i1].maximum >= \ (easycap_control[i1].maximum >=
peasycap->hue)) { peasycap->hue)) {
if (peasycap->hue == value) { if (peasycap->hue == value) {
SAM("unchanged hue at 0x%02X\n", value); SAM("unchanged hue at 0x%02X\n", value);
...@@ -832,7 +832,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -832,7 +832,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
peasycap->inputset[k].hue = peasycap->hue; peasycap->inputset[k].hue = peasycap->hue;
} }
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) { if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
peasycap->inputset[peasycap->input].hue = \ peasycap->inputset[peasycap->input].hue =
peasycap->hue; peasycap->hue;
peasycap->inputset[peasycap->input].hue_ok = 1; peasycap->inputset[peasycap->input].hue_ok = 1;
} else } else
...@@ -870,11 +870,11 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) { ...@@ -870,11 +870,11 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) {
i1 = 0; i1 = 0;
while (0xFFFFFFFF != easycap_control[i1].id) { while (0xFFFFFFFF != easycap_control[i1].id) {
if (V4L2_CID_AUDIO_VOLUME == easycap_control[i1].id) { if (V4L2_CID_AUDIO_VOLUME == easycap_control[i1].id) {
if ((easycap_control[i1].minimum > value) || \ if ((easycap_control[i1].minimum > value) ||
(easycap_control[i1].maximum < value)) (easycap_control[i1].maximum < value))
value = easycap_control[i1].default_value; value = easycap_control[i1].default_value;
if ((easycap_control[i1].minimum <= peasycap->volume) && \ if ((easycap_control[i1].minimum <= peasycap->volume) &&
(easycap_control[i1].maximum >= \ (easycap_control[i1].maximum >=
peasycap->volume)) { peasycap->volume)) {
if (peasycap->volume == value) { if (peasycap->volume == value) {
SAM("unchanged volume at 0x%02X\n", value); SAM("unchanged volume at 0x%02X\n", value);
...@@ -882,14 +882,14 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -882,14 +882,14 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
} }
} }
peasycap->volume = value; peasycap->volume = value;
mood = (16 > peasycap->volume) ? 16 : \ mood = (16 > peasycap->volume) ? 16 :
((31 < peasycap->volume) ? 31 : \ ((31 < peasycap->volume) ? 31 :
(__s8) peasycap->volume); (__s8) peasycap->volume);
if (!audio_gainset(peasycap->pusb_device, mood)) { if (!audio_gainset(peasycap->pusb_device, mood)) {
SAM("adjusting volume to 0x%02X\n", mood); SAM("adjusting volume to 0x%02X\n", mood);
return 0; return 0;
} else { } else {
SAM("WARNING: failed to adjust volume to " \ SAM("WARNING: failed to adjust volume to "
"0x%2X\n", mood); "0x%2X\n", mood);
return -ENOENT; return -ENOENT;
} }
...@@ -904,8 +904,8 @@ return -ENOENT; ...@@ -904,8 +904,8 @@ return -ENOENT;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
* AN ALTERNATIVE METHOD OF MUTING MIGHT SEEM TO BE: * AN ALTERNATIVE METHOD OF MUTING MIGHT SEEM TO BE:
* usb_set_interface(peasycap->pusb_device, \ * usb_set_interface(peasycap->pusb_device,
* peasycap->audio_interface, \ * peasycap->audio_interface,
* peasycap->audio_altsetting_off); * peasycap->audio_altsetting_off);
* HOWEVER, AFTER THIS COMMAND IS ISSUED ALL SUBSEQUENT URBS RECEIVE STATUS * HOWEVER, AFTER THIS COMMAND IS ISSUED ALL SUBSEQUENT URBS RECEIVE STATUS
* -ESHUTDOWN. THE HANDLER ROUTINE easyxxx_complete() DECLINES TO RESUBMIT * -ESHUTDOWN. THE HANDLER ROUTINE easyxxx_complete() DECLINES TO RESUBMIT
...@@ -932,13 +932,13 @@ while (0xFFFFFFFF != easycap_control[i1].id) { ...@@ -932,13 +932,13 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
case 1: { case 1: {
peasycap->audio_idle = 1; peasycap->audio_idle = 1;
peasycap->timeval0.tv_sec = 0; peasycap->timeval0.tv_sec = 0;
SAM("adjusting mute: %i=peasycap->audio_idle\n", \ SAM("adjusting mute: %i=peasycap->audio_idle\n",
peasycap->audio_idle); peasycap->audio_idle);
return 0; return 0;
} }
default: { default: {
peasycap->audio_idle = 0; peasycap->audio_idle = 0;
SAM("adjusting mute: %i=peasycap->audio_idle\n", \ SAM("adjusting mute: %i=peasycap->audio_idle\n",
peasycap->audio_idle); peasycap->audio_idle);
return 0; return 0;
} }
...@@ -990,7 +990,7 @@ if (NULL == p) { ...@@ -990,7 +990,7 @@ if (NULL == p) {
kd = isdongle(peasycap); kd = isdongle(peasycap);
if (0 <= kd && DONGLE_MANY > kd) { if (0 <= kd && DONGLE_MANY > kd) {
if (mutex_lock_interruptible(&easycapdc60_dongle[kd].mutex_video)) { if (mutex_lock_interruptible(&easycapdc60_dongle[kd].mutex_video)) {
SAY("ERROR: cannot lock " \ SAY("ERROR: cannot lock "
"easycapdc60_dongle[%i].mutex_video\n", kd); "easycapdc60_dongle[%i].mutex_video\n", kd);
return -ERESTARTSYS; return -ERESTARTSYS;
} }
...@@ -1063,9 +1063,9 @@ case VIDIOC_QUERYCAP: { ...@@ -1063,9 +1063,9 @@ case VIDIOC_QUERYCAP: {
if (3 > i) { if (3 > i) {
rc = (int) strict_strtol(p1, 10, &lng); rc = (int) strict_strtol(p1, 10, &lng);
if (0 != rc) { if (0 != rc) {
SAM("ERROR: %i=strict_strtol(%s,.,,)\n", \ SAM("ERROR: %i=strict_strtol(%s,.,,)\n",
rc, p1); rc, p1);
mutex_unlock(&easycapdc60_dongle[kd].\ mutex_unlock(&easycapdc60_dongle[kd].
mutex_video); mutex_video);
return -EINVAL; return -EINVAL;
} }
...@@ -1075,27 +1075,27 @@ case VIDIOC_QUERYCAP: { ...@@ -1075,27 +1075,27 @@ case VIDIOC_QUERYCAP: {
} }
memset(&v4l2_capability, 0, sizeof(struct v4l2_capability)); memset(&v4l2_capability, 0, sizeof(struct v4l2_capability));
strlcpy(&v4l2_capability.driver[0], "easycap", \ strlcpy(&v4l2_capability.driver[0], "easycap",
sizeof(v4l2_capability.driver)); sizeof(v4l2_capability.driver));
v4l2_capability.capabilities = \ v4l2_capability.capabilities =
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | \ V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE; V4L2_CAP_AUDIO | V4L2_CAP_READWRITE;
v4l2_capability.version = KERNEL_VERSION(k[0], k[1], k[2]); v4l2_capability.version = KERNEL_VERSION(k[0], k[1], k[2]);
JOM(8, "v4l2_capability.version=(%i,%i,%i)\n", k[0], k[1], k[2]); JOM(8, "v4l2_capability.version=(%i,%i,%i)\n", k[0], k[1], k[2]);
strlcpy(&v4l2_capability.card[0], "EasyCAP DC60", \ strlcpy(&v4l2_capability.card[0], "EasyCAP DC60",
sizeof(v4l2_capability.card)); sizeof(v4l2_capability.card));
if (usb_make_path(peasycap->pusb_device, &v4l2_capability.bus_info[0],\ if (usb_make_path(peasycap->pusb_device, &v4l2_capability.bus_info[0],
sizeof(v4l2_capability.bus_info)) < 0) { sizeof(v4l2_capability.bus_info)) < 0) {
strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info", \ strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info",
sizeof(v4l2_capability.bus_info)); sizeof(v4l2_capability.bus_info));
JOM(8, "%s=v4l2_capability.bus_info\n", \ JOM(8, "%s=v4l2_capability.bus_info\n",
&v4l2_capability.bus_info[0]); &v4l2_capability.bus_info[0]);
} }
if (0 != copy_to_user((void __user *)arg, &v4l2_capability, \ if (0 != copy_to_user((void __user *)arg, &v4l2_capability,
sizeof(struct v4l2_capability))) { sizeof(struct v4l2_capability))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1109,7 +1109,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1109,7 +1109,7 @@ case VIDIOC_ENUMINPUT: {
JOM(8, "VIDIOC_ENUMINPUT\n"); JOM(8, "VIDIOC_ENUMINPUT\n");
if (0 != copy_from_user(&v4l2_input, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_input, (void __user *)arg,
sizeof(struct v4l2_input))) { sizeof(struct v4l2_input))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1125,7 +1125,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1125,7 +1125,7 @@ case VIDIOC_ENUMINPUT: {
v4l2_input.type = V4L2_INPUT_TYPE_CAMERA; v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
v4l2_input.audioset = 0x01; v4l2_input.audioset = 0x01;
v4l2_input.tuner = 0; v4l2_input.tuner = 0;
v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \ v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
V4L2_STD_NTSC ; V4L2_STD_NTSC ;
v4l2_input.status = 0; v4l2_input.status = 0;
JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]); JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
...@@ -1137,7 +1137,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1137,7 +1137,7 @@ case VIDIOC_ENUMINPUT: {
v4l2_input.type = V4L2_INPUT_TYPE_CAMERA; v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
v4l2_input.audioset = 0x01; v4l2_input.audioset = 0x01;
v4l2_input.tuner = 0; v4l2_input.tuner = 0;
v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \ v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
V4L2_STD_NTSC ; V4L2_STD_NTSC ;
v4l2_input.status = 0; v4l2_input.status = 0;
JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]); JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
...@@ -1149,7 +1149,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1149,7 +1149,7 @@ case VIDIOC_ENUMINPUT: {
v4l2_input.type = V4L2_INPUT_TYPE_CAMERA; v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
v4l2_input.audioset = 0x01; v4l2_input.audioset = 0x01;
v4l2_input.tuner = 0; v4l2_input.tuner = 0;
v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \ v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
V4L2_STD_NTSC ; V4L2_STD_NTSC ;
v4l2_input.status = 0; v4l2_input.status = 0;
JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]); JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
...@@ -1161,7 +1161,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1161,7 +1161,7 @@ case VIDIOC_ENUMINPUT: {
v4l2_input.type = V4L2_INPUT_TYPE_CAMERA; v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
v4l2_input.audioset = 0x01; v4l2_input.audioset = 0x01;
v4l2_input.tuner = 0; v4l2_input.tuner = 0;
v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \ v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
V4L2_STD_NTSC ; V4L2_STD_NTSC ;
v4l2_input.status = 0; v4l2_input.status = 0;
JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]); JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
...@@ -1173,7 +1173,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1173,7 +1173,7 @@ case VIDIOC_ENUMINPUT: {
v4l2_input.type = V4L2_INPUT_TYPE_CAMERA; v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
v4l2_input.audioset = 0x01; v4l2_input.audioset = 0x01;
v4l2_input.tuner = 0; v4l2_input.tuner = 0;
v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \ v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
V4L2_STD_NTSC ; V4L2_STD_NTSC ;
v4l2_input.status = 0; v4l2_input.status = 0;
JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]); JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
...@@ -1185,7 +1185,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1185,7 +1185,7 @@ case VIDIOC_ENUMINPUT: {
v4l2_input.type = V4L2_INPUT_TYPE_CAMERA; v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
v4l2_input.audioset = 0x01; v4l2_input.audioset = 0x01;
v4l2_input.tuner = 0; v4l2_input.tuner = 0;
v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \ v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
V4L2_STD_NTSC ; V4L2_STD_NTSC ;
v4l2_input.status = 0; v4l2_input.status = 0;
JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]); JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
...@@ -1198,7 +1198,7 @@ case VIDIOC_ENUMINPUT: { ...@@ -1198,7 +1198,7 @@ case VIDIOC_ENUMINPUT: {
} }
} }
if (0 != copy_to_user((void __user *)arg, &v4l2_input, \ if (0 != copy_to_user((void __user *)arg, &v4l2_input,
sizeof(struct v4l2_input))) { sizeof(struct v4l2_input))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1266,7 +1266,7 @@ case VIDIOC_ENUMAUDOUT: { ...@@ -1266,7 +1266,7 @@ case VIDIOC_ENUMAUDOUT: {
JOM(8, "VIDIOC_ENUMAUDOUT\n"); JOM(8, "VIDIOC_ENUMAUDOUT\n");
if (0 != copy_from_user(&v4l2_audioout, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_audioout, (void __user *)arg,
sizeof(struct v4l2_audioout))) { sizeof(struct v4l2_audioout))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1280,7 +1280,7 @@ case VIDIOC_ENUMAUDOUT: { ...@@ -1280,7 +1280,7 @@ case VIDIOC_ENUMAUDOUT: {
v4l2_audioout.index = 0; v4l2_audioout.index = 0;
strcpy(&v4l2_audioout.name[0], "Soundtrack"); strcpy(&v4l2_audioout.name[0], "Soundtrack");
if (0 != copy_to_user((void __user *)arg, &v4l2_audioout, \ if (0 != copy_to_user((void __user *)arg, &v4l2_audioout,
sizeof(struct v4l2_audioout))) { sizeof(struct v4l2_audioout))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1294,7 +1294,7 @@ case VIDIOC_QUERYCTRL: { ...@@ -1294,7 +1294,7 @@ case VIDIOC_QUERYCTRL: {
JOM(8, "VIDIOC_QUERYCTRL\n"); JOM(8, "VIDIOC_QUERYCTRL\n");
if (0 != copy_from_user(&v4l2_queryctrl, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_queryctrl, (void __user *)arg,
sizeof(struct v4l2_queryctrl))) { sizeof(struct v4l2_queryctrl))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1303,9 +1303,9 @@ case VIDIOC_QUERYCTRL: { ...@@ -1303,9 +1303,9 @@ case VIDIOC_QUERYCTRL: {
i1 = 0; i1 = 0;
while (0xFFFFFFFF != easycap_control[i1].id) { while (0xFFFFFFFF != easycap_control[i1].id) {
if (easycap_control[i1].id == v4l2_queryctrl.id) { if (easycap_control[i1].id == v4l2_queryctrl.id) {
JOM(8, "VIDIOC_QUERYCTRL %s=easycap_control[%i]" \ JOM(8, "VIDIOC_QUERYCTRL %s=easycap_control[%i]"
".name\n", &easycap_control[i1].name[0], i1); ".name\n", &easycap_control[i1].name[0], i1);
memcpy(&v4l2_queryctrl, &easycap_control[i1], \ memcpy(&v4l2_queryctrl, &easycap_control[i1],
sizeof(struct v4l2_queryctrl)); sizeof(struct v4l2_queryctrl));
break; break;
} }
...@@ -1316,7 +1316,7 @@ case VIDIOC_QUERYCTRL: { ...@@ -1316,7 +1316,7 @@ case VIDIOC_QUERYCTRL: {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EINVAL; return -EINVAL;
} }
if (0 != copy_to_user((void __user *)arg, &v4l2_queryctrl, \ if (0 != copy_to_user((void __user *)arg, &v4l2_queryctrl,
sizeof(struct v4l2_queryctrl))) { sizeof(struct v4l2_queryctrl))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1340,7 +1340,7 @@ case VIDIOC_G_CTRL: { ...@@ -1340,7 +1340,7 @@ case VIDIOC_G_CTRL: {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -ENOMEM; return -ENOMEM;
} }
if (0 != copy_from_user(pv4l2_control, (void __user *)arg, \ if (0 != copy_from_user(pv4l2_control, (void __user *)arg,
sizeof(struct v4l2_control))) { sizeof(struct v4l2_control))) {
kfree(pv4l2_control); kfree(pv4l2_control);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
...@@ -1382,14 +1382,14 @@ case VIDIOC_G_CTRL: { ...@@ -1382,14 +1382,14 @@ case VIDIOC_G_CTRL: {
break; break;
} }
default: { default: {
SAM("ERROR: unknown V4L2 control: 0x%08X=id\n", \ SAM("ERROR: unknown V4L2 control: 0x%08X=id\n",
pv4l2_control->id); pv4l2_control->id);
kfree(pv4l2_control); kfree(pv4l2_control);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EINVAL; return -EINVAL;
} }
} }
if (0 != copy_to_user((void __user *)arg, pv4l2_control, \ if (0 != copy_to_user((void __user *)arg, pv4l2_control,
sizeof(struct v4l2_control))) { sizeof(struct v4l2_control))) {
kfree(pv4l2_control); kfree(pv4l2_control);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
...@@ -1410,7 +1410,7 @@ case VIDIOC_S_CTRL: ...@@ -1410,7 +1410,7 @@ case VIDIOC_S_CTRL:
JOM(8, "VIDIOC_S_CTRL\n"); JOM(8, "VIDIOC_S_CTRL\n");
if (0 != copy_from_user(&v4l2_control, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_control, (void __user *)arg,
sizeof(struct v4l2_control))) { sizeof(struct v4l2_control))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1461,7 +1461,7 @@ case VIDIOC_S_CTRL: ...@@ -1461,7 +1461,7 @@ case VIDIOC_S_CTRL:
break; break;
} }
default: { default: {
SAM("ERROR: unknown V4L2 control: 0x%08X=id\n", \ SAM("ERROR: unknown V4L2 control: 0x%08X=id\n",
v4l2_control.id); v4l2_control.id);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EINVAL; return -EINVAL;
...@@ -1482,7 +1482,7 @@ case VIDIOC_ENUM_FMT: { ...@@ -1482,7 +1482,7 @@ case VIDIOC_ENUM_FMT: {
JOM(8, "VIDIOC_ENUM_FMT\n"); JOM(8, "VIDIOC_ENUM_FMT\n");
if (0 != copy_from_user(&v4l2_fmtdesc, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_fmtdesc, (void __user *)arg,
sizeof(struct v4l2_fmtdesc))) { sizeof(struct v4l2_fmtdesc))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1543,7 +1543,7 @@ case VIDIOC_ENUM_FMT: { ...@@ -1543,7 +1543,7 @@ case VIDIOC_ENUM_FMT: {
return -EINVAL; return -EINVAL;
} }
} }
if (0 != copy_to_user((void __user *)arg, &v4l2_fmtdesc, \ if (0 != copy_to_user((void __user *)arg, &v4l2_fmtdesc,
sizeof(struct v4l2_fmtdesc))) { sizeof(struct v4l2_fmtdesc))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1562,7 +1562,7 @@ case VIDIOC_ENUM_FRAMESIZES: { ...@@ -1562,7 +1562,7 @@ case VIDIOC_ENUM_FRAMESIZES: {
JOM(8, "VIDIOC_ENUM_FRAMESIZES\n"); JOM(8, "VIDIOC_ENUM_FRAMESIZES\n");
if (0 != copy_from_user(&v4l2_frmsizeenum, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_frmsizeenum, (void __user *)arg,
sizeof(struct v4l2_frmsizeenum))) { sizeof(struct v4l2_frmsizeenum))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1577,40 +1577,40 @@ case VIDIOC_ENUM_FRAMESIZES: { ...@@ -1577,40 +1577,40 @@ case VIDIOC_ENUM_FRAMESIZES: {
case 0: { case 0: {
v4l2_frmsizeenum.discrete.width = 640; v4l2_frmsizeenum.discrete.width = 640;
v4l2_frmsizeenum.discrete.height = 480; v4l2_frmsizeenum.discrete.height = 480;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
case 1: { case 1: {
v4l2_frmsizeenum.discrete.width = 320; v4l2_frmsizeenum.discrete.width = 320;
v4l2_frmsizeenum.discrete.height = 240; v4l2_frmsizeenum.discrete.height = 240;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
case 2: { case 2: {
v4l2_frmsizeenum.discrete.width = 720; v4l2_frmsizeenum.discrete.width = 720;
v4l2_frmsizeenum.discrete.height = 480; v4l2_frmsizeenum.discrete.height = 480;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
case 3: { case 3: {
v4l2_frmsizeenum.discrete.width = 360; v4l2_frmsizeenum.discrete.width = 360;
v4l2_frmsizeenum.discrete.height = 240; v4l2_frmsizeenum.discrete.height = 240;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
...@@ -1625,50 +1625,50 @@ case VIDIOC_ENUM_FRAMESIZES: { ...@@ -1625,50 +1625,50 @@ case VIDIOC_ENUM_FRAMESIZES: {
case 0: { case 0: {
v4l2_frmsizeenum.discrete.width = 640; v4l2_frmsizeenum.discrete.width = 640;
v4l2_frmsizeenum.discrete.height = 480; v4l2_frmsizeenum.discrete.height = 480;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
case 1: { case 1: {
v4l2_frmsizeenum.discrete.width = 320; v4l2_frmsizeenum.discrete.width = 320;
v4l2_frmsizeenum.discrete.height = 240; v4l2_frmsizeenum.discrete.height = 240;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
case 2: { case 2: {
v4l2_frmsizeenum.discrete.width = 704; v4l2_frmsizeenum.discrete.width = 704;
v4l2_frmsizeenum.discrete.height = 576; v4l2_frmsizeenum.discrete.height = 576;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
case 3: { case 3: {
v4l2_frmsizeenum.discrete.width = 720; v4l2_frmsizeenum.discrete.width = 720;
v4l2_frmsizeenum.discrete.height = 576; v4l2_frmsizeenum.discrete.height = 576;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
case 4: { case 4: {
v4l2_frmsizeenum.discrete.width = 360; v4l2_frmsizeenum.discrete.width = 360;
v4l2_frmsizeenum.discrete.height = 288; v4l2_frmsizeenum.discrete.height = 288;
JOM(8, "%i=index: %ix%i\n", index, \ JOM(8, "%i=index: %ix%i\n", index,
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.width), \ discrete.width),
(int)(v4l2_frmsizeenum.\ (int)(v4l2_frmsizeenum.
discrete.height)); discrete.height));
break; break;
} }
...@@ -1679,7 +1679,7 @@ case VIDIOC_ENUM_FRAMESIZES: { ...@@ -1679,7 +1679,7 @@ case VIDIOC_ENUM_FRAMESIZES: {
} }
} }
} }
if (0 != copy_to_user((void __user *)arg, &v4l2_frmsizeenum, \ if (0 != copy_to_user((void __user *)arg, &v4l2_frmsizeenum,
sizeof(struct v4l2_frmsizeenum))) { sizeof(struct v4l2_frmsizeenum))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1708,7 +1708,7 @@ case VIDIOC_ENUM_FRAMEINTERVALS: { ...@@ -1708,7 +1708,7 @@ case VIDIOC_ENUM_FRAMEINTERVALS: {
denominator = 25; denominator = 25;
} }
if (0 != copy_from_user(&v4l2_frmivalenum, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_frmivalenum, (void __user *)arg,
sizeof(struct v4l2_frmivalenum))) { sizeof(struct v4l2_frmivalenum))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1722,16 +1722,16 @@ case VIDIOC_ENUM_FRAMEINTERVALS: { ...@@ -1722,16 +1722,16 @@ case VIDIOC_ENUM_FRAMEINTERVALS: {
case 0: { case 0: {
v4l2_frmivalenum.discrete.numerator = 1; v4l2_frmivalenum.discrete.numerator = 1;
v4l2_frmivalenum.discrete.denominator = denominator; v4l2_frmivalenum.discrete.denominator = denominator;
JOM(8, "%i=index: %i/%i\n", index, \ JOM(8, "%i=index: %i/%i\n", index,
(int)(v4l2_frmivalenum.discrete.numerator), \ (int)(v4l2_frmivalenum.discrete.numerator),
(int)(v4l2_frmivalenum.discrete.denominator)); (int)(v4l2_frmivalenum.discrete.denominator));
break; break;
} }
case 1: { case 1: {
v4l2_frmivalenum.discrete.numerator = 1; v4l2_frmivalenum.discrete.numerator = 1;
v4l2_frmivalenum.discrete.denominator = denominator/5; v4l2_frmivalenum.discrete.denominator = denominator/5;
JOM(8, "%i=index: %i/%i\n", index, \ JOM(8, "%i=index: %i/%i\n", index,
(int)(v4l2_frmivalenum.discrete.numerator), \ (int)(v4l2_frmivalenum.discrete.numerator),
(int)(v4l2_frmivalenum.discrete.denominator)); (int)(v4l2_frmivalenum.discrete.denominator));
break; break;
} }
...@@ -1741,7 +1741,7 @@ case VIDIOC_ENUM_FRAMEINTERVALS: { ...@@ -1741,7 +1741,7 @@ case VIDIOC_ENUM_FRAMEINTERVALS: {
return -EINVAL; return -EINVAL;
} }
} }
if (0 != copy_to_user((void __user *)arg, &v4l2_frmivalenum, \ if (0 != copy_to_user((void __user *)arg, &v4l2_frmivalenum,
sizeof(struct v4l2_frmivalenum))) { sizeof(struct v4l2_frmivalenum))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1767,7 +1767,7 @@ case VIDIOC_G_FMT: { ...@@ -1767,7 +1767,7 @@ case VIDIOC_G_FMT: {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -ENOMEM; return -ENOMEM;
} }
if (0 != copy_from_user(pv4l2_format, (void __user *)arg, \ if (0 != copy_from_user(pv4l2_format, (void __user *)arg,
sizeof(struct v4l2_format))) { sizeof(struct v4l2_format))) {
kfree(pv4l2_format); kfree(pv4l2_format);
kfree(pv4l2_pix_format); kfree(pv4l2_pix_format);
...@@ -1784,13 +1784,13 @@ case VIDIOC_G_FMT: { ...@@ -1784,13 +1784,13 @@ case VIDIOC_G_FMT: {
memset(pv4l2_pix_format, 0, sizeof(struct v4l2_pix_format)); memset(pv4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
pv4l2_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; pv4l2_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
memcpy(&pv4l2_format->fmt.pix, \ memcpy(&pv4l2_format->fmt.pix,
&easycap_format[peasycap->format_offset]\ &easycap_format[peasycap->format_offset]
.v4l2_format.fmt.pix, sizeof(struct v4l2_pix_format)); .v4l2_format.fmt.pix, sizeof(struct v4l2_pix_format));
JOM(8, "user is told: %s\n", \ JOM(8, "user is told: %s\n",
&easycap_format[peasycap->format_offset].name[0]); &easycap_format[peasycap->format_offset].name[0]);
if (0 != copy_to_user((void __user *)arg, pv4l2_format, \ if (0 != copy_to_user((void __user *)arg, pv4l2_format,
sizeof(struct v4l2_format))) { sizeof(struct v4l2_format))) {
kfree(pv4l2_format); kfree(pv4l2_format);
kfree(pv4l2_pix_format); kfree(pv4l2_pix_format);
...@@ -1817,17 +1817,17 @@ case VIDIOC_S_FMT: { ...@@ -1817,17 +1817,17 @@ case VIDIOC_S_FMT: {
try = false; try = false;
} }
if (0 != copy_from_user(&v4l2_format, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_format, (void __user *)arg,
sizeof(struct v4l2_format))) { sizeof(struct v4l2_format))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
} }
best_format = adjust_format(peasycap, \ best_format = adjust_format(peasycap,
v4l2_format.fmt.pix.width, \ v4l2_format.fmt.pix.width,
v4l2_format.fmt.pix.height, \ v4l2_format.fmt.pix.height,
v4l2_format.fmt.pix.pixelformat, \ v4l2_format.fmt.pix.pixelformat,
v4l2_format.fmt.pix.field, \ v4l2_format.fmt.pix.field,
try); try);
if (0 > best_format) { if (0 > best_format) {
if (-EBUSY == best_format) { if (-EBUSY == best_format) {
...@@ -1842,11 +1842,11 @@ case VIDIOC_S_FMT: { ...@@ -1842,11 +1842,11 @@ case VIDIOC_S_FMT: {
memset(&v4l2_pix_format, 0, sizeof(struct v4l2_pix_format)); memset(&v4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
v4l2_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; v4l2_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
memcpy(&(v4l2_format.fmt.pix), &(easycap_format[best_format]\ memcpy(&(v4l2_format.fmt.pix), &(easycap_format[best_format]
.v4l2_format.fmt.pix), sizeof(v4l2_pix_format)); .v4l2_format.fmt.pix), sizeof(v4l2_pix_format));
JOM(8, "user is told: %s\n", &easycap_format[best_format].name[0]); JOM(8, "user is told: %s\n", &easycap_format[best_format].name[0]);
if (0 != copy_to_user((void __user *)arg, &v4l2_format, \ if (0 != copy_to_user((void __user *)arg, &v4l2_format,
sizeof(struct v4l2_format))) { sizeof(struct v4l2_format))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1859,7 +1859,7 @@ case VIDIOC_CROPCAP: { ...@@ -1859,7 +1859,7 @@ case VIDIOC_CROPCAP: {
JOM(8, "VIDIOC_CROPCAP\n"); JOM(8, "VIDIOC_CROPCAP\n");
if (0 != copy_from_user(&v4l2_cropcap, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_cropcap, (void __user *)arg,
sizeof(struct v4l2_cropcap))) { sizeof(struct v4l2_cropcap))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1883,7 +1883,7 @@ case VIDIOC_CROPCAP: { ...@@ -1883,7 +1883,7 @@ case VIDIOC_CROPCAP: {
JOM(8, "user is told: %ix%i\n", peasycap->width, peasycap->height); JOM(8, "user is told: %ix%i\n", peasycap->width, peasycap->height);
if (0 != copy_to_user((void __user *)arg, &v4l2_cropcap, \ if (0 != copy_to_user((void __user *)arg, &v4l2_cropcap,
sizeof(struct v4l2_cropcap))) { sizeof(struct v4l2_cropcap))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1899,7 +1899,7 @@ case VIDIOC_S_CROP: { ...@@ -1899,7 +1899,7 @@ case VIDIOC_S_CROP: {
} }
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
case VIDIOC_QUERYSTD: { case VIDIOC_QUERYSTD: {
JOM(8, "VIDIOC_QUERYSTD: " \ JOM(8, "VIDIOC_QUERYSTD: "
"EasyCAP is incapable of detecting standard\n"); "EasyCAP is incapable of detecting standard\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EINVAL; return -EINVAL;
...@@ -1921,7 +1921,7 @@ case VIDIOC_ENUMSTD: { ...@@ -1921,7 +1921,7 @@ case VIDIOC_ENUMSTD: {
JOM(8, "VIDIOC_ENUMSTD\n"); JOM(8, "VIDIOC_ENUMSTD\n");
if (0 != copy_from_user(&v4l2_standard, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_standard, (void __user *)arg,
sizeof(struct v4l2_standard))) { sizeof(struct v4l2_standard))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1929,7 +1929,7 @@ case VIDIOC_ENUMSTD: { ...@@ -1929,7 +1929,7 @@ case VIDIOC_ENUMSTD: {
index = v4l2_standard.index; index = v4l2_standard.index;
last3 = last2; last2 = last1; last1 = last0; last0 = index; last3 = last2; last2 = last1; last1 = last0; last0 = index;
if ((index == last3) && (index == last2) && \ if ((index == last3) && (index == last2) &&
(index == last1) && (index == last0)) { (index == last1) && (index == last0)) {
index++; index++;
last3 = last2; last2 = last1; last1 = last0; last0 = index; last3 = last2; last2 = last1; last1 = last0; last0 = index;
...@@ -1948,14 +1948,14 @@ case VIDIOC_ENUMSTD: { ...@@ -1948,14 +1948,14 @@ case VIDIOC_ENUMSTD: {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EINVAL; return -EINVAL;
} }
JOM(8, "%i=index: %s\n", index, \ JOM(8, "%i=index: %s\n", index,
&(peasycap_standard->v4l2_standard.name[0])); &(peasycap_standard->v4l2_standard.name[0]));
memcpy(&v4l2_standard, &(peasycap_standard->v4l2_standard), \ memcpy(&v4l2_standard, &(peasycap_standard->v4l2_standard),
sizeof(struct v4l2_standard)); sizeof(struct v4l2_standard));
v4l2_standard.index = index; v4l2_standard.index = index;
if (0 != copy_to_user((void __user *)arg, &v4l2_standard, \ if (0 != copy_to_user((void __user *)arg, &v4l2_standard,
sizeof(struct v4l2_standard))) { sizeof(struct v4l2_standard))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1970,13 +1970,13 @@ case VIDIOC_G_STD: { ...@@ -1970,13 +1970,13 @@ case VIDIOC_G_STD: {
JOM(8, "VIDIOC_G_STD\n"); JOM(8, "VIDIOC_G_STD\n");
if (0 > peasycap->standard_offset) { if (0 > peasycap->standard_offset) {
JOM(8, "%i=peasycap->standard_offset\n", \ JOM(8, "%i=peasycap->standard_offset\n",
peasycap->standard_offset); peasycap->standard_offset);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EBUSY; return -EBUSY;
} }
if (0 != copy_from_user(&std_id, (void __user *)arg, \ if (0 != copy_from_user(&std_id, (void __user *)arg,
sizeof(v4l2_std_id))) { sizeof(v4l2_std_id))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -1985,10 +1985,10 @@ case VIDIOC_G_STD: { ...@@ -1985,10 +1985,10 @@ case VIDIOC_G_STD: {
peasycap_standard = &easycap_standard[peasycap->standard_offset]; peasycap_standard = &easycap_standard[peasycap->standard_offset];
std_id = peasycap_standard->v4l2_standard.id; std_id = peasycap_standard->v4l2_standard.id;
JOM(8, "user is told: %s\n", \ JOM(8, "user is told: %s\n",
&peasycap_standard->v4l2_standard.name[0]); &peasycap_standard->v4l2_standard.name[0]);
if (0 != copy_to_user((void __user *)arg, &std_id, \ if (0 != copy_to_user((void __user *)arg, &std_id,
sizeof(v4l2_std_id))) { sizeof(v4l2_std_id))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2002,14 +2002,14 @@ case VIDIOC_S_STD: { ...@@ -2002,14 +2002,14 @@ case VIDIOC_S_STD: {
JOM(8, "VIDIOC_S_STD\n"); JOM(8, "VIDIOC_S_STD\n");
if (0 != copy_from_user(&std_id, (void __user *)arg, \ if (0 != copy_from_user(&std_id, (void __user *)arg,
sizeof(v4l2_std_id))) { sizeof(v4l2_std_id))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
} }
JOM(8, "User requests standard: 0x%08X%08X\n", \ JOM(8, "User requests standard: 0x%08X%08X\n",
(int)((std_id & (((v4l2_std_id)0xFFFFFFFF) << 32)) >> 32), \ (int)((std_id & (((v4l2_std_id)0xFFFFFFFF) << 32)) >> 32),
(int)(std_id & ((v4l2_std_id)0xFFFFFFFF))); (int)(std_id & ((v4l2_std_id)0xFFFFFFFF)));
rc = adjust_standard(peasycap, std_id); rc = adjust_standard(peasycap, std_id);
...@@ -2027,7 +2027,7 @@ case VIDIOC_REQBUFS: { ...@@ -2027,7 +2027,7 @@ case VIDIOC_REQBUFS: {
JOM(8, "VIDIOC_REQBUFS\n"); JOM(8, "VIDIOC_REQBUFS\n");
if (0 != copy_from_user(&v4l2_requestbuffers, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_requestbuffers, (void __user *)arg,
sizeof(struct v4l2_requestbuffers))) { sizeof(struct v4l2_requestbuffers))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2048,16 +2048,16 @@ case VIDIOC_REQBUFS: { ...@@ -2048,16 +2048,16 @@ case VIDIOC_REQBUFS: {
if (nbuffers > FRAME_BUFFER_MANY) if (nbuffers > FRAME_BUFFER_MANY)
nbuffers = FRAME_BUFFER_MANY; nbuffers = FRAME_BUFFER_MANY;
if (v4l2_requestbuffers.count == nbuffers) { if (v4l2_requestbuffers.count == nbuffers) {
JOM(8, " ... agree to %i buffers\n", \ JOM(8, " ... agree to %i buffers\n",
nbuffers); nbuffers);
} else { } else {
JOM(8, " ... insist on %i buffers\n", \ JOM(8, " ... insist on %i buffers\n",
nbuffers); nbuffers);
v4l2_requestbuffers.count = nbuffers; v4l2_requestbuffers.count = nbuffers;
} }
peasycap->frame_buffer_many = nbuffers; peasycap->frame_buffer_many = nbuffers;
if (0 != copy_to_user((void __user *)arg, &v4l2_requestbuffers, \ if (0 != copy_to_user((void __user *)arg, &v4l2_requestbuffers,
sizeof(struct v4l2_requestbuffers))) { sizeof(struct v4l2_requestbuffers))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2072,13 +2072,13 @@ case VIDIOC_QUERYBUF: { ...@@ -2072,13 +2072,13 @@ case VIDIOC_QUERYBUF: {
JOM(8, "VIDIOC_QUERYBUF\n"); JOM(8, "VIDIOC_QUERYBUF\n");
if (peasycap->video_eof) { if (peasycap->video_eof) {
JOM(8, "returning -EIO because %i=video_eof\n", \ JOM(8, "returning -EIO because %i=video_eof\n",
peasycap->video_eof); peasycap->video_eof);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EIO; return -EIO;
} }
if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg,
sizeof(struct v4l2_buffer))) { sizeof(struct v4l2_buffer))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2095,8 +2095,8 @@ case VIDIOC_QUERYBUF: { ...@@ -2095,8 +2095,8 @@ case VIDIOC_QUERYBUF: {
v4l2_buffer.index = index; v4l2_buffer.index = index;
v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
v4l2_buffer.bytesused = peasycap->frame_buffer_used; v4l2_buffer.bytesused = peasycap->frame_buffer_used;
v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED | \ v4l2_buffer.flags = V4L2_BUF_FLAG_MAPPED |
peasycap->done[index] | \ peasycap->done[index] |
peasycap->queued[index]; peasycap->queued[index];
v4l2_buffer.field = V4L2_FIELD_NONE; v4l2_buffer.field = V4L2_FIELD_NONE;
v4l2_buffer.memory = V4L2_MEMORY_MMAP; v4l2_buffer.memory = V4L2_MEMORY_MMAP;
...@@ -2108,14 +2108,14 @@ case VIDIOC_QUERYBUF: { ...@@ -2108,14 +2108,14 @@ case VIDIOC_QUERYBUF: {
JOM(16, " %10i=bytesused\n", v4l2_buffer.bytesused); JOM(16, " %10i=bytesused\n", v4l2_buffer.bytesused);
JOM(16, " 0x%08X=flags\n", v4l2_buffer.flags); JOM(16, " 0x%08X=flags\n", v4l2_buffer.flags);
JOM(16, " %10i=field\n", v4l2_buffer.field); JOM(16, " %10i=field\n", v4l2_buffer.field);
JOM(16, " %10li=timestamp.tv_usec\n", \ JOM(16, " %10li=timestamp.tv_usec\n",
(long)v4l2_buffer.timestamp.tv_usec); (long)v4l2_buffer.timestamp.tv_usec);
JOM(16, " %10i=sequence\n", v4l2_buffer.sequence); JOM(16, " %10i=sequence\n", v4l2_buffer.sequence);
JOM(16, " 0x%08X=memory\n", v4l2_buffer.memory); JOM(16, " 0x%08X=memory\n", v4l2_buffer.memory);
JOM(16, " %10i=m.offset\n", v4l2_buffer.m.offset); JOM(16, " %10i=m.offset\n", v4l2_buffer.m.offset);
JOM(16, " %10i=length\n", v4l2_buffer.length); JOM(16, " %10i=length\n", v4l2_buffer.length);
if (0 != copy_to_user((void __user *)arg, &v4l2_buffer, \ if (0 != copy_to_user((void __user *)arg, &v4l2_buffer,
sizeof(struct v4l2_buffer))) { sizeof(struct v4l2_buffer))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2128,7 +2128,7 @@ case VIDIOC_QBUF: { ...@@ -2128,7 +2128,7 @@ case VIDIOC_QBUF: {
JOM(8, "VIDIOC_QBUF\n"); JOM(8, "VIDIOC_QBUF\n");
if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg,
sizeof(struct v4l2_buffer))) { sizeof(struct v4l2_buffer))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2142,7 +2142,7 @@ case VIDIOC_QBUF: { ...@@ -2142,7 +2142,7 @@ case VIDIOC_QBUF: {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EINVAL; return -EINVAL;
} }
if (v4l2_buffer.index < 0 || \ if (v4l2_buffer.index < 0 ||
(v4l2_buffer.index >= peasycap->frame_buffer_many)) { (v4l2_buffer.index >= peasycap->frame_buffer_many)) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EINVAL; return -EINVAL;
...@@ -2152,13 +2152,13 @@ case VIDIOC_QBUF: { ...@@ -2152,13 +2152,13 @@ case VIDIOC_QBUF: {
peasycap->done[v4l2_buffer.index] = 0; peasycap->done[v4l2_buffer.index] = 0;
peasycap->queued[v4l2_buffer.index] = V4L2_BUF_FLAG_QUEUED; peasycap->queued[v4l2_buffer.index] = V4L2_BUF_FLAG_QUEUED;
if (0 != copy_to_user((void __user *)arg, &v4l2_buffer, \ if (0 != copy_to_user((void __user *)arg, &v4l2_buffer,
sizeof(struct v4l2_buffer))) { sizeof(struct v4l2_buffer))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
} }
JOM(8, "..... user queueing frame buffer %i\n", \ JOM(8, "..... user queueing frame buffer %i\n",
(int)v4l2_buffer.index); (int)v4l2_buffer.index);
peasycap->frame_lock = 0; peasycap->frame_lock = 0;
...@@ -2184,14 +2184,14 @@ case VIDIOC_DQBUF: ...@@ -2184,14 +2184,14 @@ case VIDIOC_DQBUF:
JOM(8, "VIDIOC_DQBUF\n"); JOM(8, "VIDIOC_DQBUF\n");
if ((peasycap->video_idle) || (peasycap->video_eof)) { if ((peasycap->video_idle) || (peasycap->video_eof)) {
JOM(8, "returning -EIO because " \ JOM(8, "returning -EIO because "
"%i=video_idle %i=video_eof\n", \ "%i=video_idle %i=video_eof\n",
peasycap->video_idle, peasycap->video_eof); peasycap->video_idle, peasycap->video_eof);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EIO; return -EIO;
} }
if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg, \ if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg,
sizeof(struct v4l2_buffer))) { sizeof(struct v4l2_buffer))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2216,7 +2216,7 @@ case VIDIOC_DQBUF: ...@@ -2216,7 +2216,7 @@ case VIDIOC_DQBUF:
else if (V4L2_FIELD_ANY == v4l2_buffer.field) else if (V4L2_FIELD_ANY == v4l2_buffer.field)
JOM(8, "user wants V4L2_FIELD_ANY\n"); JOM(8, "user wants V4L2_FIELD_ANY\n");
else else
JOM(8, "user wants V4L2_FIELD_...UNKNOWN: %i\n", \ JOM(8, "user wants V4L2_FIELD_...UNKNOWN: %i\n",
v4l2_buffer.field); v4l2_buffer.field);
} }
...@@ -2237,9 +2237,9 @@ case VIDIOC_DQBUF: ...@@ -2237,9 +2237,9 @@ case VIDIOC_DQBUF:
do { do {
rcdq = easycap_dqbuf(peasycap, 0); rcdq = easycap_dqbuf(peasycap, 0);
if (-EIO == rcdq) { if (-EIO == rcdq) {
JOM(8, "returning -EIO because " \ JOM(8, "returning -EIO because "
"dqbuf() returned -EIO\n"); "dqbuf() returned -EIO\n");
mutex_unlock(&easycapdc60_dongle[kd].\ mutex_unlock(&easycapdc60_dongle[kd].
mutex_video); mutex_video);
return -EIO; return -EIO;
} }
...@@ -2251,7 +2251,7 @@ case VIDIOC_DQBUF: ...@@ -2251,7 +2251,7 @@ case VIDIOC_DQBUF:
} }
} }
if (V4L2_BUF_FLAG_DONE != peasycap->done[peasycap->frame_read]) { if (V4L2_BUF_FLAG_DONE != peasycap->done[peasycap->frame_read]) {
JOM(8, "V4L2_BUF_FLAG_DONE != 0x%08X\n", \ JOM(8, "V4L2_BUF_FLAG_DONE != 0x%08X\n",
peasycap->done[peasycap->frame_read]); peasycap->done[peasycap->frame_read]);
} }
peasycap->polled = 0; peasycap->polled = 0;
...@@ -2264,7 +2264,7 @@ case VIDIOC_DQBUF: ...@@ -2264,7 +2264,7 @@ case VIDIOC_DQBUF:
for (i = 0; i < 180; i++) for (i = 0; i < 180; i++)
j += peasycap->merit[i]; j += peasycap->merit[i];
if (90 < j) { if (90 < j) {
SAM("easycap driver shutting down " \ SAM("easycap driver shutting down "
"on condition blue\n"); "on condition blue\n");
peasycap->video_eof = 1; peasycap->audio_eof = 1; peasycap->video_eof = 1; peasycap->audio_eof = 1;
} }
...@@ -2303,10 +2303,10 @@ case VIDIOC_DQBUF: ...@@ -2303,10 +2303,10 @@ case VIDIOC_DQBUF:
timeval2.tv_sec = timeval1.tv_sec + sdr.quotient; timeval2.tv_sec = timeval1.tv_sec + sdr.quotient;
} }
if (!(peasycap->isequence % 500)) { if (!(peasycap->isequence % 500)) {
fudge = ((long long int)(1000000)) * \ fudge = ((long long int)(1000000)) *
((long long int)(timeval.tv_sec - \ ((long long int)(timeval.tv_sec -
timeval2.tv_sec)) + \ timeval2.tv_sec)) +
(long long int)(timeval.tv_usec - \ (long long int)(timeval.tv_usec -
timeval2.tv_usec); timeval2.tv_usec);
sdr = signed_div(fudge, 1000); sdr = signed_div(fudge, 1000);
sll = sdr.quotient; sll = sdr.quotient;
...@@ -2327,16 +2327,16 @@ case VIDIOC_DQBUF: ...@@ -2327,16 +2327,16 @@ case VIDIOC_DQBUF:
JOM(16, " %10i=bytesused\n", v4l2_buffer.bytesused); JOM(16, " %10i=bytesused\n", v4l2_buffer.bytesused);
JOM(16, " 0x%08X=flags\n", v4l2_buffer.flags); JOM(16, " 0x%08X=flags\n", v4l2_buffer.flags);
JOM(16, " %10i=field\n", v4l2_buffer.field); JOM(16, " %10i=field\n", v4l2_buffer.field);
JOM(16, " %10li=timestamp.tv_sec\n", \ JOM(16, " %10li=timestamp.tv_sec\n",
(long)v4l2_buffer.timestamp.tv_sec); (long)v4l2_buffer.timestamp.tv_sec);
JOM(16, " %10li=timestamp.tv_usec\n", \ JOM(16, " %10li=timestamp.tv_usec\n",
(long)v4l2_buffer.timestamp.tv_usec); (long)v4l2_buffer.timestamp.tv_usec);
JOM(16, " %10i=sequence\n", v4l2_buffer.sequence); JOM(16, " %10i=sequence\n", v4l2_buffer.sequence);
JOM(16, " 0x%08X=memory\n", v4l2_buffer.memory); JOM(16, " 0x%08X=memory\n", v4l2_buffer.memory);
JOM(16, " %10i=m.offset\n", v4l2_buffer.m.offset); JOM(16, " %10i=m.offset\n", v4l2_buffer.m.offset);
JOM(16, " %10i=length\n", v4l2_buffer.length); JOM(16, " %10i=length\n", v4l2_buffer.length);
if (0 != copy_to_user((void __user *)arg, &v4l2_buffer, \ if (0 != copy_to_user((void __user *)arg, &v4l2_buffer,
sizeof(struct v4l2_buffer))) { sizeof(struct v4l2_buffer))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2344,17 +2344,17 @@ case VIDIOC_DQBUF: ...@@ -2344,17 +2344,17 @@ case VIDIOC_DQBUF:
input = peasycap->frame_buffer[peasycap->frame_read][0].input; input = peasycap->frame_buffer[peasycap->frame_read][0].input;
if (0x08 & input) { if (0x08 & input) {
JOM(8, "user is offered frame buffer %i, input %i\n", \ JOM(8, "user is offered frame buffer %i, input %i\n",
peasycap->frame_read, (0x07 & input)); peasycap->frame_read, (0x07 & input));
} else { } else {
JOM(8, "user is offered frame buffer %i\n", \ JOM(8, "user is offered frame buffer %i\n",
peasycap->frame_read); peasycap->frame_read);
} }
peasycap->frame_lock = 1; peasycap->frame_lock = 1;
JOM(8, "%i=peasycap->frame_fill\n", peasycap->frame_fill); JOM(8, "%i=peasycap->frame_fill\n", peasycap->frame_fill);
if (peasycap->frame_read == peasycap->frame_fill) { if (peasycap->frame_read == peasycap->frame_fill) {
if (peasycap->frame_lock) { if (peasycap->frame_lock) {
JOM(8, "WORRY: filling frame buffer " \ JOM(8, "WORRY: filling frame buffer "
"while offered to user\n"); "while offered to user\n");
} }
} }
...@@ -2421,7 +2421,7 @@ case VIDIOC_G_PARM: { ...@@ -2421,7 +2421,7 @@ case VIDIOC_G_PARM: {
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -ENOMEM; return -ENOMEM;
} }
if (0 != copy_from_user(pv4l2_streamparm, (void __user *)arg, \ if (0 != copy_from_user(pv4l2_streamparm, (void __user *)arg,
sizeof(struct v4l2_streamparm))) { sizeof(struct v4l2_streamparm))) {
kfree(pv4l2_streamparm); kfree(pv4l2_streamparm);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
...@@ -2438,22 +2438,22 @@ case VIDIOC_G_PARM: { ...@@ -2438,22 +2438,22 @@ case VIDIOC_G_PARM: {
pv4l2_streamparm->parm.capture.timeperframe.numerator = 1; pv4l2_streamparm->parm.capture.timeperframe.numerator = 1;
if (peasycap->fps) { if (peasycap->fps) {
pv4l2_streamparm->parm.capture.timeperframe.\ pv4l2_streamparm->parm.capture.timeperframe.
denominator = peasycap->fps; denominator = peasycap->fps;
} else { } else {
if (true == peasycap->ntsc) { if (true == peasycap->ntsc) {
pv4l2_streamparm->parm.capture.timeperframe.\ pv4l2_streamparm->parm.capture.timeperframe.
denominator = 30; denominator = 30;
} else { } else {
pv4l2_streamparm->parm.capture.timeperframe.\ pv4l2_streamparm->parm.capture.timeperframe.
denominator = 25; denominator = 25;
} }
} }
pv4l2_streamparm->parm.capture.readbuffers = \ pv4l2_streamparm->parm.capture.readbuffers =
peasycap->frame_buffer_many; peasycap->frame_buffer_many;
pv4l2_streamparm->parm.capture.extendedmode = 0; pv4l2_streamparm->parm.capture.extendedmode = 0;
if (0 != copy_to_user((void __user *)arg, pv4l2_streamparm, \ if (0 != copy_to_user((void __user *)arg, pv4l2_streamparm,
sizeof(struct v4l2_streamparm))) { sizeof(struct v4l2_streamparm))) {
kfree(pv4l2_streamparm); kfree(pv4l2_streamparm);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
...@@ -2520,7 +2520,7 @@ return 0; ...@@ -2520,7 +2520,7 @@ return 0;
/*****************************************************************************/ /*****************************************************************************/
#if !defined(EASYCAP_NEEDS_ALSA) #if !defined(EASYCAP_NEEDS_ALSA)
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#if ((defined(EASYCAP_IS_VIDEODEV_CLIENT)) || \ #if ((defined(EASYCAP_IS_VIDEODEV_CLIENT)) ||
(defined(EASYCAP_NEEDS_UNLOCKED_IOCTL))) (defined(EASYCAP_NEEDS_UNLOCKED_IOCTL)))
long long
easyoss_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) { easyoss_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) {
...@@ -2674,7 +2674,7 @@ case SNDCTL_DSP_SETFMT: { ...@@ -2674,7 +2674,7 @@ case SNDCTL_DSP_SETFMT: {
JOM(8, "........... %i=outgoing\n", outgoing); JOM(8, "........... %i=outgoing\n", outgoing);
JOM(8, " cf. %i=AFMT_S16_LE\n", AFMT_S16_LE); JOM(8, " cf. %i=AFMT_S16_LE\n", AFMT_S16_LE);
JOM(8, " cf. %i=AFMT_U8\n", AFMT_U8); JOM(8, " cf. %i=AFMT_U8\n", AFMT_U8);
if (0 != copy_to_user((void __user *)arg, &outgoing, \ if (0 != copy_to_user((void __user *)arg, &outgoing,
sizeof(int))) { sizeof(int))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -EFAULT; return -EFAULT;
...@@ -2762,8 +2762,8 @@ case SNDCTL_DSP_SETTRIGGER: { ...@@ -2762,8 +2762,8 @@ case SNDCTL_DSP_SETTRIGGER: {
return -EFAULT; return -EFAULT;
} }
JOM(8, "........... %i=incoming\n", incoming); JOM(8, "........... %i=incoming\n", incoming);
JOM(8, "........... cf 0x%x=PCM_ENABLE_INPUT " \ JOM(8, "........... cf 0x%x=PCM_ENABLE_INPUT "
"0x%x=PCM_ENABLE_OUTPUT\n", \ "0x%x=PCM_ENABLE_OUTPUT\n",
PCM_ENABLE_INPUT, PCM_ENABLE_OUTPUT); PCM_ENABLE_INPUT, PCM_ENABLE_OUTPUT);
; ;
; ;
...@@ -2796,7 +2796,7 @@ case SNDCTL_DSP_GETISPACE: { ...@@ -2796,7 +2796,7 @@ case SNDCTL_DSP_GETISPACE: {
audio_buf_info.fragsize = 0; audio_buf_info.fragsize = 0;
audio_buf_info.fragstotal = 0; audio_buf_info.fragstotal = 0;
if (0 != copy_to_user((void __user *)arg, &audio_buf_info, \ if (0 != copy_to_user((void __user *)arg, &audio_buf_info,
sizeof(int))) { sizeof(int))) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -EFAULT; return -EFAULT;
......
...@@ -259,28 +259,28 @@ GET(p, 0x0114, &get4); ...@@ -259,28 +259,28 @@ GET(p, 0x0114, &get4);
GET(p, 0x0115, &get5); GET(p, 0x0115, &get5);
GET(p, 0x0116, &get6); GET(p, 0x0116, &get6);
GET(p, 0x0117, &get7); GET(p, 0x0117, &get7);
JOT(8, "0x%03X, 0x%03X, " \ JOT(8, "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X\n", \ "0x%03X, 0x%03X\n",
get0, get1, get2, get3, get4, get5, get6, get7); get0, get1, get2, get3, get4, get5, get6, get7);
JOT(8, "....cf PAL_720x526: " \ JOT(8, "....cf PAL_720x526: "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X\n", \ "0x%03X, 0x%03X\n",
0x000, 0x000, 0x001, 0x000, 0x5A0, 0x005, 0x121, 0x001); 0x000, 0x000, 0x001, 0x000, 0x5A0, 0x005, 0x121, 0x001);
JOT(8, "....cf PAL_704x526: " \ JOT(8, "....cf PAL_704x526: "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X\n", \ "0x%03X, 0x%03X\n",
0x004, 0x000, 0x001, 0x000, 0x584, 0x005, 0x121, 0x001); 0x004, 0x000, 0x001, 0x000, 0x584, 0x005, 0x121, 0x001);
JOT(8, "....cf VGA_640x480: " \ JOT(8, "....cf VGA_640x480: "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X, " \ "0x%03X, 0x%03X, "
"0x%03X, 0x%03X\n", \ "0x%03X, 0x%03X\n",
0x008, 0x000, 0x020, 0x000, 0x508, 0x005, 0x110, 0x001); 0x008, 0x000, 0x020, 0x000, 0x508, 0x005, 0x110, 0x001);
return 0; return 0;
} }
...@@ -336,13 +336,13 @@ if (NULL == p) ...@@ -336,13 +336,13 @@ if (NULL == p)
i0 = 0; i0 = 0;
if (true == ntsc) { if (true == ntsc) {
while (0xFF != saa7113configNTSC[i0].reg) { while (0xFF != saa7113configNTSC[i0].reg) {
ir = write_saa(p, saa7113configNTSC[i0].reg, \ ir = write_saa(p, saa7113configNTSC[i0].reg,
saa7113configNTSC[i0].set); saa7113configNTSC[i0].set);
i0++; i0++;
} }
} else { } else {
while (0xFF != saa7113configPAL[i0].reg) { while (0xFF != saa7113configPAL[i0].reg) {
ir = write_saa(p, saa7113configPAL[i0].reg, \ ir = write_saa(p, saa7113configPAL[i0].reg,
saa7113configPAL[i0].set); saa7113configPAL[i0].set);
i0++; i0++;
} }
...@@ -400,7 +400,7 @@ SET(p, 0x0500, 0x008B); ...@@ -400,7 +400,7 @@ SET(p, 0x0500, 0x008B);
GET(p, 0x0502, &igot); got502 = (0xFF & igot); GET(p, 0x0502, &igot); got502 = (0xFF & igot);
GET(p, 0x0503, &igot); got503 = (0xFF & igot); GET(p, 0x0503, &igot); got503 = (0xFF & igot);
JOT(16, "write_vt(., 0x%04X, 0x%04X): was 0x%04X\n", \ JOT(16, "write_vt(., 0x%04X, 0x%04X): was 0x%04X\n",
reg0, set0, ((got503 << 8) | got502)); reg0, set0, ((got503 << 8) | got502));
set502 = (0x00FF & set0); set502 = (0x00FF & set0);
...@@ -485,9 +485,9 @@ if (true == ntsc) { ...@@ -485,9 +485,9 @@ if (true == ntsc) {
ir = read_saa(p, saa7113configNTSC[i0].reg); ir = read_saa(p, saa7113configNTSC[i0].reg);
if (ir != saa7113configNTSC[i0].set) { if (ir != saa7113configNTSC[i0].set) {
SAY("SAA register 0x%02X has 0x%02X, " \ SAY("SAA register 0x%02X has 0x%02X, "
"expected 0x%02X\n", \ "expected 0x%02X\n",
saa7113configNTSC[i0].reg, \ saa7113configNTSC[i0].reg,
ir, saa7113configNTSC[i0].set); ir, saa7113configNTSC[i0].set);
rc--; rc--;
} }
...@@ -502,9 +502,9 @@ if (true == ntsc) { ...@@ -502,9 +502,9 @@ if (true == ntsc) {
ir = read_saa(p, saa7113configPAL[i0].reg); ir = read_saa(p, saa7113configPAL[i0].reg);
if (ir != saa7113configPAL[i0].set) { if (ir != saa7113configPAL[i0].set) {
SAY("SAA register 0x%02X has 0x%02X, " \ SAY("SAA register 0x%02X has 0x%02X, "
"expected 0x%02X\n", \ "expected 0x%02X\n",
saa7113configPAL[i0].reg, \ saa7113configPAL[i0].reg,
ir, saa7113configPAL[i0].set); ir, saa7113configPAL[i0].set);
rc--; rc--;
} }
...@@ -603,23 +603,23 @@ if (true == ntsc) { ...@@ -603,23 +603,23 @@ if (true == ntsc) {
} }
ir = read_stk(p, stk1160configNTSC[i0].reg); ir = read_stk(p, stk1160configNTSC[i0].reg);
if (0x100 == stk1160configNTSC[i0].reg) { if (0x100 == stk1160configNTSC[i0].reg) {
if ((ir != (0xFF & stk1160configNTSC[i0].set)) && \ if ((ir != (0xFF & stk1160configNTSC[i0].set)) &&
(ir != (0x80 | (0xFF & \ (ir != (0x80 | (0xFF &
stk1160configNTSC[i0].set))) && \ stk1160configNTSC[i0].set))) &&
(0xFFFF != \ (0xFFFF !=
stk1160configNTSC[i0].set)) { stk1160configNTSC[i0].set)) {
SAY("STK register 0x%03X has 0x%02X, " \ SAY("STK register 0x%03X has 0x%02X, "
"expected 0x%02X\n", \ "expected 0x%02X\n",
stk1160configNTSC[i0].reg, \ stk1160configNTSC[i0].reg,
ir, stk1160configNTSC[i0].set); ir, stk1160configNTSC[i0].set);
} }
i0++; continue; i0++; continue;
} }
if ((ir != (0xFF & stk1160configNTSC[i0].set)) && \ if ((ir != (0xFF & stk1160configNTSC[i0].set)) &&
(0xFFFF != stk1160configNTSC[i0].set)) { (0xFFFF != stk1160configNTSC[i0].set)) {
SAY("STK register 0x%03X has 0x%02X, " \ SAY("STK register 0x%03X has 0x%02X, "
"expected 0x%02X\n", \ "expected 0x%02X\n",
stk1160configNTSC[i0].reg, \ stk1160configNTSC[i0].reg,
ir, stk1160configNTSC[i0].set); ir, stk1160configNTSC[i0].set);
} }
i0++; i0++;
...@@ -634,23 +634,23 @@ if (true == ntsc) { ...@@ -634,23 +634,23 @@ if (true == ntsc) {
} }
ir = read_stk(p, stk1160configPAL[i0].reg); ir = read_stk(p, stk1160configPAL[i0].reg);
if (0x100 == stk1160configPAL[i0].reg) { if (0x100 == stk1160configPAL[i0].reg) {
if ((ir != (0xFF & stk1160configPAL[i0].set)) && \ if ((ir != (0xFF & stk1160configPAL[i0].set)) &&
(ir != (0x80 | (0xFF & \ (ir != (0x80 | (0xFF &
stk1160configPAL[i0].set))) && \ stk1160configPAL[i0].set))) &&
(0xFFFF != \ (0xFFFF !=
stk1160configPAL[i0].set)) { stk1160configPAL[i0].set)) {
SAY("STK register 0x%03X has 0x%02X, " \ SAY("STK register 0x%03X has 0x%02X, "
"expected 0x%02X\n", \ "expected 0x%02X\n",
stk1160configPAL[i0].reg, \ stk1160configPAL[i0].reg,
ir, stk1160configPAL[i0].set); ir, stk1160configPAL[i0].set);
} }
i0++; continue; i0++; continue;
} }
if ((ir != (0xFF & stk1160configPAL[i0].set)) && \ if ((ir != (0xFF & stk1160configPAL[i0].set)) &&
(0xFFFF != stk1160configPAL[i0].set)) { (0xFFFF != stk1160configPAL[i0].set)) {
SAY("STK register 0x%03X has 0x%02X, " \ SAY("STK register 0x%03X has 0x%02X, "
"expected 0x%02X\n", \ "expected 0x%02X\n",
stk1160configPAL[i0].reg, \ stk1160configPAL[i0].reg,
ir, stk1160configPAL[i0].set); ir, stk1160configPAL[i0].set);
} }
i0++; i0++;
...@@ -717,7 +717,7 @@ switch (input) { ...@@ -717,7 +717,7 @@ switch (input) {
case 0: case 0:
case 1: { case 1: {
if (0 != write_saa(p, 0x02, 0x80)) { if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n", \ SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input); input);
} }
SET(p, 0x0000, 0x0098); SET(p, 0x0000, 0x0098);
...@@ -726,7 +726,7 @@ case 1: { ...@@ -726,7 +726,7 @@ case 1: {
} }
case 2: { case 2: {
if (0 != write_saa(p, 0x02, 0x80)) { if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n", \ SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input); input);
} }
SET(p, 0x0000, 0x0090); SET(p, 0x0000, 0x0090);
...@@ -735,7 +735,7 @@ case 2: { ...@@ -735,7 +735,7 @@ case 2: {
} }
case 3: { case 3: {
if (0 != write_saa(p, 0x02, 0x80)) { if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n", \ SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input); input);
} }
SET(p, 0x0000, 0x0088); SET(p, 0x0000, 0x0088);
...@@ -744,7 +744,7 @@ case 3: { ...@@ -744,7 +744,7 @@ case 3: {
} }
case 4: { case 4: {
if (0 != write_saa(p, 0x02, 0x80)) { if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n", \ SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input); input);
} }
SET(p, 0x0000, 0x0080); SET(p, 0x0000, 0x0080);
...@@ -757,22 +757,22 @@ case 5: { ...@@ -757,22 +757,22 @@ case 5: {
switch (mode) { switch (mode) {
case 7: { case 7: {
if (0 != write_saa(p, 0x02, 0x87)) { if (0 != write_saa(p, 0x02, 0x87)) {
SAY("ERROR: failed to set SAA register 0x02 " \ SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input); "for input %i\n", input);
} }
if (0 != write_saa(p, 0x05, 0xFF)) { if (0 != write_saa(p, 0x05, 0xFF)) {
SAY("ERROR: failed to set SAA register 0x05 " \ SAY("ERROR: failed to set SAA register 0x05 "
"for input %i\n", input); "for input %i\n", input);
} }
break; break;
} }
case 9: { case 9: {
if (0 != write_saa(p, 0x02, 0x89)) { if (0 != write_saa(p, 0x02, 0x89)) {
SAY("ERROR: failed to set SAA register 0x02 " \ SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input); "for input %i\n", input);
} }
if (0 != write_saa(p, 0x05, 0x00)) { if (0 != write_saa(p, 0x05, 0x00)) {
SAY("ERROR: failed to set SAA register 0x05 " \ SAY("ERROR: failed to set SAA register 0x05 "
"for input %i\n", input); "for input %i\n", input);
} }
break; break;
...@@ -783,11 +783,11 @@ case 5: { ...@@ -783,11 +783,11 @@ case 5: {
} }
} }
if (0 != write_saa(p, 0x04, 0x00)) { if (0 != write_saa(p, 0x04, 0x00)) {
SAY("ERROR: failed to set SAA register 0x04 for input %i\n", \ SAY("ERROR: failed to set SAA register 0x04 for input %i\n",
input); input);
} }
if (0 != write_saa(p, 0x09, 0x80)) { if (0 != write_saa(p, 0x09, 0x80)) {
SAY("ERROR: failed to set SAA register 0x09 for input %i\n", \ SAY("ERROR: failed to set SAA register 0x09 for input %i\n",
input); input);
} }
SET(p, 0x0002, 0x0093); SET(p, 0x0002, 0x0093);
...@@ -809,7 +809,7 @@ return 0; ...@@ -809,7 +809,7 @@ return 0;
} }
/****************************************************************************/ /****************************************************************************/
int int
set_resolution(struct usb_device *p, \ set_resolution(struct usb_device *p,
__u16 set0, __u16 set1, __u16 set2, __u16 set3) __u16 set0, __u16 set1, __u16 set2, __u16 set3)
{ {
__u16 u0x0111, u0x0113, u0x0115, u0x0117; __u16 u0x0111, u0x0113, u0x0115, u0x0117;
...@@ -915,25 +915,25 @@ int rc0, rc1; ...@@ -915,25 +915,25 @@ int rc0, rc1;
if (!pusb_device) if (!pusb_device)
return -ENODEV; return -ENODEV;
rc1 = 0; igot = 0; rc1 = 0; igot = 0;
rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0), \ rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
(__u8)0x01, \ (__u8)0x01,
(__u8)(USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE), \ (__u8)(USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
(__u16)value, \ (__u16)value,
(__u16)index, \ (__u16)index,
(void *)NULL, \ (void *)NULL,
(__u16)0, \ (__u16)0,
(int)500); (int)500);
#if defined(NOREADBACK) #if defined(NOREADBACK)
# #
#else #else
rc1 = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0), \ rc1 = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0),
(__u8)0x00, \ (__u8)0x00,
(__u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE), \ (__u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
(__u16)0x00, \ (__u16)0x00,
(__u16)index, \ (__u16)index,
(void *)&igot, \ (void *)&igot,
(__u16)sizeof(__u16), \ (__u16)sizeof(__u16),
(int)50000); (int)50000);
igot = 0xFF & igot; igot = 0xFF & igot;
switch (index) { switch (index) {
...@@ -951,15 +951,15 @@ case 0x205: ...@@ -951,15 +951,15 @@ case 0x205:
case 0x350: case 0x350:
case 0x351: { case 0x351: {
if (0 != (0xFF & igot)) { if (0 != (0xFF & igot)) {
JOT(8, "unexpected 0x%02X for STK register 0x%03X\n", \ JOT(8, "unexpected 0x%02X for STK register 0x%03X\n",
igot, index); igot, index);
} }
break; break;
} }
default: { default: {
if ((0xFF & value) != (0xFF & igot)) { if ((0xFF & value) != (0xFF & igot)) {
JOT(8, "unexpected 0x%02X != 0x%02X " \ JOT(8, "unexpected 0x%02X != 0x%02X "
"for STK register 0x%03X\n", \ "for STK register 0x%03X\n",
igot, value, index); igot, value, index);
} }
break; break;
...@@ -977,13 +977,13 @@ int ir; ...@@ -977,13 +977,13 @@ int ir;
if (!pusb_device) if (!pusb_device)
return -ENODEV; return -ENODEV;
ir = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0), \ ir = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0),
(__u8)0x00, \ (__u8)0x00,
(__u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE), \ (__u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
(__u16)0x00, \ (__u16)0x00,
(__u16)index, \ (__u16)index,
(void *)pvoid, \ (void *)pvoid,
sizeof(__u8), \ sizeof(__u8),
(int)50000); (int)50000);
return 0xFF & ir; return 0xFF & ir;
} }
...@@ -993,13 +993,13 @@ wakeup_device(struct usb_device *pusb_device) ...@@ -993,13 +993,13 @@ wakeup_device(struct usb_device *pusb_device)
{ {
if (!pusb_device) if (!pusb_device)
return -ENODEV; return -ENODEV;
return usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0), \ return usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
(__u8)USB_REQ_SET_FEATURE, \ (__u8)USB_REQ_SET_FEATURE,
(__u8)(USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE), \ (__u8)(USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE),
USB_DEVICE_REMOTE_WAKEUP, \ USB_DEVICE_REMOTE_WAKEUP,
(__u16)0, \ (__u16)0,
(void *) NULL, \ (void *) NULL,
(__u16)0, \ (__u16)0,
(int)50000); (int)50000);
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -1018,7 +1018,7 @@ int rc, id1, id2; ...@@ -1018,7 +1018,7 @@ int rc, id1, id2;
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
const __u8 request = 0x01; const __u8 request = 0x01;
const __u8 requesttype = \ const __u8 requesttype =
(__u8)(USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE); (__u8)(USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
const __u16 value_unmute = 0x0200; const __u16 value_unmute = 0x0200;
const __u16 index = 0x0301; const __u16 index = 0x0301;
...@@ -1031,24 +1031,24 @@ pusb_device = peasycap->pusb_device; ...@@ -1031,24 +1031,24 @@ pusb_device = peasycap->pusb_device;
if (NULL == pusb_device) if (NULL == pusb_device)
return -ENODEV; return -ENODEV;
JOM(8, "%02X %02X %02X %02X %02X %02X %02X %02X\n", \ JOM(8, "%02X %02X %02X %02X %02X %02X %02X %02X\n",
requesttype, request, \ requesttype, request,
(0x00FF & value_unmute), \ (0x00FF & value_unmute),
(0xFF00 & value_unmute) >> 8, \ (0xFF00 & value_unmute) >> 8,
(0x00FF & index), \ (0x00FF & index),
(0xFF00 & index) >> 8, \ (0xFF00 & index) >> 8,
(0x00FF & length), \ (0x00FF & length),
(0xFF00 & length) >> 8); (0xFF00 & length) >> 8);
buffer[0] = 0x01; buffer[0] = 0x01;
rc = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0), \ rc = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
(__u8)request, \ (__u8)request,
(__u8)requesttype, \ (__u8)requesttype,
(__u16)value_unmute, \ (__u16)value_unmute,
(__u16)index, \ (__u16)index,
(void *)&buffer[0], \ (void *)&buffer[0],
(__u16)length, \ (__u16)length,
(int)50000); (int)50000);
JOT(8, "0x%02X=buffer\n", *((__u8 *) &buffer[0])); JOT(8, "0x%02X=buffer\n", *((__u8 *) &buffer[0]));
...@@ -1209,7 +1209,7 @@ if (0 > igot) { ...@@ -1209,7 +1209,7 @@ if (0 > igot) {
mute = 0x8000 & ((unsigned int)igot); mute = 0x8000 & ((unsigned int)igot);
mute = 0; mute = 0;
JOT(8, "0x%04X=(mute|u8|(u8<<8)) for VT1612A register 0x10,...0x18\n", \ JOT(8, "0x%04X=(mute|u8|(u8<<8)) for VT1612A register 0x10,...0x18\n",
mute | u8 | (u8 << 8)); mute | u8 | (u8 << 8));
write_vt(pusb_device, 0x0010, (mute | u8 | (u8 << 8))); write_vt(pusb_device, 0x0010, (mute | u8 | (u8 << 8)));
write_vt(pusb_device, 0x0012, (mute | u8 | (u8 << 8))); write_vt(pusb_device, 0x0012, (mute | u8 | (u8 << 8)));
...@@ -1230,7 +1230,7 @@ if (16 <= loud) ...@@ -1230,7 +1230,7 @@ if (16 <= loud)
else else
u8 = 0; u8 = 0;
JOT(8, "0x%04X=(mute|u8|(u8<<8)) for VT1612A register 0x1C\n", \ JOT(8, "0x%04X=(mute|u8|(u8<<8)) for VT1612A register 0x1C\n",
mute | u8 | (u8 << 8)); mute | u8 | (u8 << 8));
write_vt(pusb_device, 0x001C, (mute | u8 | (u8 << 8))); write_vt(pusb_device, 0x001C, (mute | u8 | (u8 << 8)));
write_vt(pusb_device, 0x001A, 0x0404); write_vt(pusb_device, 0x001A, 0x0404);
......
...@@ -186,7 +186,7 @@ if (NULL == peasycap->pusb_device) { ...@@ -186,7 +186,7 @@ if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} else { } else {
JOM(16, "0x%08lX=peasycap->pusb_device\n", \ JOM(16, "0x%08lX=peasycap->pusb_device\n",
(long int)peasycap->pusb_device); (long int)peasycap->pusb_device);
} }
file->private_data = peasycap; file->private_data = peasycap;
...@@ -272,7 +272,7 @@ else { ...@@ -272,7 +272,7 @@ else {
rate = ready_saa(peasycap->pusb_device); rate = ready_saa(peasycap->pusb_device);
if (0 > rate) { if (0 > rate) {
JOM(8, "not ready to capture after %i ms ...\n", PATIENCE); JOM(8, "not ready to capture after %i ms ...\n", PATIENCE);
JOM(8, "... saa register 0x1F has 0x%02X\n", \ JOM(8, "... saa register 0x1F has 0x%02X\n",
read_saa(peasycap->pusb_device, 0x1F)); read_saa(peasycap->pusb_device, 0x1F));
ntsc = peasycap->ntsc; ntsc = peasycap->ntsc;
} else { } else {
...@@ -323,17 +323,17 @@ if (true == other) { ...@@ -323,17 +323,17 @@ if (true == other) {
peasycap_standard = &easycap_standard[0]; peasycap_standard = &easycap_standard[0];
while (0xFFFF != peasycap_standard->mask) { while (0xFFFF != peasycap_standard->mask) {
if (true == ntsc) { if (true == ntsc) {
if (NTSC_M == \ if (NTSC_M ==
peasycap_standard->v4l2_standard.index) { peasycap_standard->v4l2_standard.index) {
peasycap->inputset[input].standard_offset = \ peasycap->inputset[input].standard_offset =
peasycap_standard - \ peasycap_standard -
&easycap_standard[0]; &easycap_standard[0];
break; break;
} }
} else { } else {
if (PAL_BGHIN == \ if (PAL_BGHIN ==
peasycap_standard->v4l2_standard.index) { peasycap_standard->v4l2_standard.index) {
peasycap->inputset[input].standard_offset = \ peasycap->inputset[input].standard_offset =
peasycap_standard - peasycap_standard -
&easycap_standard[0]; &easycap_standard[0];
break; break;
...@@ -345,7 +345,7 @@ if (true == other) { ...@@ -345,7 +345,7 @@ if (true == other) {
SAM("ERROR: standard not found\n"); SAM("ERROR: standard not found\n");
return -EINVAL; return -EINVAL;
} }
JOM(8, "%i=peasycap->inputset[%i].standard_offset\n", \ JOM(8, "%i=peasycap->inputset[%i].standard_offset\n",
peasycap->inputset[input].standard_offset, input); peasycap->inputset[input].standard_offset, input);
} }
peasycap->format_offset = -8192; peasycap->format_offset = -8192;
...@@ -372,12 +372,12 @@ if (0 > peasycap->input) { ...@@ -372,12 +372,12 @@ if (0 > peasycap->input) {
return -ENOENT; return -ENOENT;
} }
if (0 > peasycap->standard_offset) { if (0 > peasycap->standard_offset) {
SAM("MISTAKE: %i=peasycap->standard_offset\n", \ SAM("MISTAKE: %i=peasycap->standard_offset\n",
peasycap->standard_offset); peasycap->standard_offset);
return -ENOENT; return -ENOENT;
} }
if (0 > peasycap->format_offset) { if (0 > peasycap->format_offset) {
SAM("MISTAKE: %i=peasycap->format_offset\n", \ SAM("MISTAKE: %i=peasycap->format_offset\n",
peasycap->format_offset); peasycap->format_offset);
return -ENOENT; return -ENOENT;
} }
...@@ -458,7 +458,7 @@ if (NULL == peasycap->pusb_device) { ...@@ -458,7 +458,7 @@ if (NULL == peasycap->pusb_device) {
return -ENODEV; return -ENODEV;
} }
rc = usb_set_interface(peasycap->pusb_device, rc = usb_set_interface(peasycap->pusb_device,
peasycap->video_interface, \ peasycap->video_interface,
peasycap->video_altsetting_off); peasycap->video_altsetting_off);
if (0 != rc) { if (0 != rc) {
SAM("ERROR: usb_set_interface() returned %i\n", rc); SAM("ERROR: usb_set_interface() returned %i\n", rc);
...@@ -494,24 +494,24 @@ select_input(peasycap->pusb_device, peasycap->input, 9); ...@@ -494,24 +494,24 @@ select_input(peasycap->pusb_device, peasycap->input, 9);
if (input == peasycap->inputset[input].input) { if (input == peasycap->inputset[input].input) {
off = peasycap->inputset[input].standard_offset; off = peasycap->inputset[input].standard_offset;
if (off != peasycap->standard_offset) { if (off != peasycap->standard_offset) {
rc = adjust_standard(peasycap, \ rc = adjust_standard(peasycap,
easycap_standard[off].v4l2_standard.id); easycap_standard[off].v4l2_standard.id);
if (0 != rc) { if (0 != rc) {
SAM("ERROR: adjust_standard() returned %i\n", rc); SAM("ERROR: adjust_standard() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
JOM(8, "%i=peasycap->standard_offset\n", \ JOM(8, "%i=peasycap->standard_offset\n",
peasycap->standard_offset); peasycap->standard_offset);
} else { } else {
JOM(8, "%i=peasycap->standard_offset unchanged\n", \ JOM(8, "%i=peasycap->standard_offset unchanged\n",
peasycap->standard_offset); peasycap->standard_offset);
} }
off = peasycap->inputset[input].format_offset; off = peasycap->inputset[input].format_offset;
if (off != peasycap->format_offset) { if (off != peasycap->format_offset) {
rc = adjust_format(peasycap, \ rc = adjust_format(peasycap,
easycap_format[off].v4l2_format.fmt.pix.width, \ easycap_format[off].v4l2_format.fmt.pix.width,
easycap_format[off].v4l2_format.fmt.pix.height, \ easycap_format[off].v4l2_format.fmt.pix.height,
easycap_format[off].v4l2_format.fmt.pix.pixelformat, \ easycap_format[off].v4l2_format.fmt.pix.pixelformat,
easycap_format[off].v4l2_format.fmt.pix.field, false); easycap_format[off].v4l2_format.fmt.pix.field, false);
if (0 > rc) { if (0 > rc) {
SAM("ERROR: adjust_format() returned %i\n", rc); SAM("ERROR: adjust_format() returned %i\n", rc);
...@@ -519,7 +519,7 @@ if (input == peasycap->inputset[input].input) { ...@@ -519,7 +519,7 @@ if (input == peasycap->inputset[input].input) {
} }
JOM(8, "%i=peasycap->format_offset\n", peasycap->format_offset); JOM(8, "%i=peasycap->format_offset\n", peasycap->format_offset);
} else { } else {
JOM(8, "%i=peasycap->format_offset unchanged\n", \ JOM(8, "%i=peasycap->format_offset unchanged\n",
peasycap->format_offset); peasycap->format_offset);
} }
mood = peasycap->inputset[input].brightness; mood = peasycap->inputset[input].brightness;
...@@ -568,7 +568,7 @@ if (NULL == peasycap->pusb_device) { ...@@ -568,7 +568,7 @@ if (NULL == peasycap->pusb_device) {
return -ENODEV; return -ENODEV;
} }
rc = usb_set_interface(peasycap->pusb_device, rc = usb_set_interface(peasycap->pusb_device,
peasycap->video_interface, \ peasycap->video_interface,
peasycap->video_altsetting_on); peasycap->video_altsetting_on);
if (0 != rc) { if (0 != rc) {
SAM("ERROR: usb_set_interface() returned %i\n", rc); SAM("ERROR: usb_set_interface() returned %i\n", rc);
...@@ -623,74 +623,74 @@ if (!peasycap->video_isoc_streaming) { ...@@ -623,74 +623,74 @@ if (!peasycap->video_isoc_streaming) {
isbuf = pdata_urb->isbuf; isbuf = pdata_urb->isbuf;
purb->interval = 1; purb->interval = 1;
purb->dev = peasycap->pusb_device; purb->dev = peasycap->pusb_device;
purb->pipe = \ purb->pipe =
usb_rcvisocpipe(peasycap->pusb_device,\ usb_rcvisocpipe(peasycap->pusb_device,
peasycap->video_endpointnumber); peasycap->video_endpointnumber);
purb->transfer_flags = URB_ISO_ASAP; purb->transfer_flags = URB_ISO_ASAP;
purb->transfer_buffer = \ purb->transfer_buffer =
peasycap->video_isoc_buffer[isbuf].pgo; peasycap->video_isoc_buffer[isbuf].pgo;
purb->transfer_buffer_length = \ purb->transfer_buffer_length =
peasycap->video_isoc_buffer_size; peasycap->video_isoc_buffer_size;
purb->complete = easycap_complete; purb->complete = easycap_complete;
purb->context = peasycap; purb->context = peasycap;
purb->start_frame = 0; purb->start_frame = 0;
purb->number_of_packets = \ purb->number_of_packets =
peasycap->video_isoc_framesperdesc; peasycap->video_isoc_framesperdesc;
for (j = 0; j < peasycap->\ for (j = 0; j < peasycap->
video_isoc_framesperdesc; j++) { video_isoc_framesperdesc; j++) {
purb->iso_frame_desc[j].\ purb->iso_frame_desc[j].
offset = j * \ offset = j *
peasycap->\ peasycap->
video_isoc_maxframesize; video_isoc_maxframesize;
purb->iso_frame_desc[j].\ purb->iso_frame_desc[j].
length = peasycap->\ length = peasycap->
video_isoc_maxframesize; video_isoc_maxframesize;
} }
rc = usb_submit_urb(purb, GFP_KERNEL); rc = usb_submit_urb(purb, GFP_KERNEL);
if (0 != rc) { if (0 != rc) {
isbad++; isbad++;
SAM("ERROR: usb_submit_urb() failed " \ SAM("ERROR: usb_submit_urb() failed "
"for urb with rc:\n"); "for urb with rc:\n");
switch (rc) { switch (rc) {
case -ENOMEM: { case -ENOMEM: {
SAM("ERROR: -ENOMEM=" \ SAM("ERROR: -ENOMEM="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
case -ENODEV: { case -ENODEV: {
SAM("ERROR: -ENODEV=" \ SAM("ERROR: -ENODEV="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
case -ENXIO: { case -ENXIO: {
SAM("ERROR: -ENXIO=" \ SAM("ERROR: -ENXIO="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
case -EINVAL: { case -EINVAL: {
SAM("ERROR: -EINVAL=" \ SAM("ERROR: -EINVAL="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
case -EAGAIN: { case -EAGAIN: {
SAM("ERROR: -EAGAIN=" \ SAM("ERROR: -EAGAIN="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
case -EFBIG: { case -EFBIG: {
SAM("ERROR: -EFBIG=" \ SAM("ERROR: -EFBIG="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
case -EPIPE: { case -EPIPE: {
SAM("ERROR: -EPIPE=" \ SAM("ERROR: -EPIPE="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
case -EMSGSIZE: { case -EMSGSIZE: {
SAM("ERROR: -EMSGSIZE=" \ SAM("ERROR: -EMSGSIZE="
"usb_submit_urb()\n"); "usb_submit_urb()\n");
break; break;
} }
...@@ -699,8 +699,8 @@ if (!peasycap->video_isoc_streaming) { ...@@ -699,8 +699,8 @@ if (!peasycap->video_isoc_streaming) {
break; break;
} }
default: { default: {
SAM("ERROR: %i=" \ SAM("ERROR: %i="
"usb_submit_urb()\n",\ "usb_submit_urb()\n",
rc); rc);
break; break;
} }
...@@ -724,7 +724,7 @@ if (!peasycap->video_isoc_streaming) { ...@@ -724,7 +724,7 @@ if (!peasycap->video_isoc_streaming) {
if (isbad) { if (isbad) {
JOM(4, "attempting cleanup instead of submitting\n"); JOM(4, "attempting cleanup instead of submitting\n");
list_for_each(plist_head, (peasycap->purb_video_head)) { list_for_each(plist_head, (peasycap->purb_video_head)) {
pdata_urb = list_entry(plist_head, struct data_urb, \ pdata_urb = list_entry(plist_head, struct data_urb,
list_head); list_head);
if (NULL != pdata_urb) { if (NULL != pdata_urb) {
purb = pdata_urb->purb; purb = pdata_urb->purb;
...@@ -760,7 +760,7 @@ if (peasycap->video_isoc_streaming) { ...@@ -760,7 +760,7 @@ if (peasycap->video_isoc_streaming) {
JOM(4, "killing video urbs\n"); JOM(4, "killing video urbs\n");
m = 0; m = 0;
list_for_each(plist_head, (peasycap->purb_video_head)) { list_for_each(plist_head, (peasycap->purb_video_head)) {
pdata_urb = list_entry(plist_head, struct data_urb, \ pdata_urb = list_entry(plist_head, struct data_urb,
list_head); list_head);
if (NULL != pdata_urb) { if (NULL != pdata_urb) {
if (NULL != pdata_urb->purb) { if (NULL != pdata_urb->purb) {
...@@ -775,7 +775,7 @@ if (peasycap->video_isoc_streaming) { ...@@ -775,7 +775,7 @@ if (peasycap->video_isoc_streaming) {
return -EFAULT; return -EFAULT;
} }
} else { } else {
JOM(8, "%i=video_isoc_streaming, no video urbs killed\n", \ JOM(8, "%i=video_isoc_streaming, no video urbs killed\n",
peasycap->video_isoc_streaming); peasycap->video_isoc_streaming);
} }
return 0; return 0;
...@@ -914,7 +914,7 @@ if ((struct list_head *)NULL != peasycap->purb_video_head) { ...@@ -914,7 +914,7 @@ if ((struct list_head *)NULL != peasycap->purb_video_head) {
pdata_urb = list_entry(plist_head, struct data_urb, list_head); pdata_urb = list_entry(plist_head, struct data_urb, list_head);
if ((struct data_urb *)NULL != pdata_urb) { if ((struct data_urb *)NULL != pdata_urb) {
kfree(pdata_urb); pdata_urb = (struct data_urb *)NULL; kfree(pdata_urb); pdata_urb = (struct data_urb *)NULL;
peasycap->allocation_video_struct -= \ peasycap->allocation_video_struct -=
sizeof(struct data_urb); sizeof(struct data_urb);
m++; m++;
} }
...@@ -928,11 +928,11 @@ JOM(4, "freeing video isoc buffers.\n"); ...@@ -928,11 +928,11 @@ JOM(4, "freeing video isoc buffers.\n");
m = 0; m = 0;
for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) {
if ((void *)NULL != peasycap->video_isoc_buffer[k].pgo) { if ((void *)NULL != peasycap->video_isoc_buffer[k].pgo) {
free_pages((unsigned long)\ free_pages((unsigned long)
(peasycap->video_isoc_buffer[k].pgo), \ (peasycap->video_isoc_buffer[k].pgo),
VIDEO_ISOC_ORDER); VIDEO_ISOC_ORDER);
peasycap->video_isoc_buffer[k].pgo = (void *)NULL; peasycap->video_isoc_buffer[k].pgo = (void *)NULL;
peasycap->allocation_video_page -= \ peasycap->allocation_video_page -=
((unsigned int)(0x01 << VIDEO_ISOC_ORDER)); ((unsigned int)(0x01 << VIDEO_ISOC_ORDER));
m++; m++;
} }
...@@ -944,7 +944,7 @@ gone = 0; ...@@ -944,7 +944,7 @@ gone = 0;
for (k = 0; k < FIELD_BUFFER_MANY; k++) { for (k = 0; k < FIELD_BUFFER_MANY; k++) {
for (m = 0; m < FIELD_BUFFER_SIZE/PAGE_SIZE; m++) { for (m = 0; m < FIELD_BUFFER_SIZE/PAGE_SIZE; m++) {
if ((void *)NULL != peasycap->field_buffer[k][m].pgo) { if ((void *)NULL != peasycap->field_buffer[k][m].pgo) {
free_page((unsigned long)\ free_page((unsigned long)
(peasycap->field_buffer[k][m].pgo)); (peasycap->field_buffer[k][m].pgo));
peasycap->field_buffer[k][m].pgo = (void *)NULL; peasycap->field_buffer[k][m].pgo = (void *)NULL;
peasycap->allocation_video_page -= 1; peasycap->allocation_video_page -= 1;
...@@ -959,7 +959,7 @@ gone = 0; ...@@ -959,7 +959,7 @@ gone = 0;
for (k = 0; k < FRAME_BUFFER_MANY; k++) { for (k = 0; k < FRAME_BUFFER_MANY; k++) {
for (m = 0; m < FRAME_BUFFER_SIZE/PAGE_SIZE; m++) { for (m = 0; m < FRAME_BUFFER_SIZE/PAGE_SIZE; m++) {
if ((void *)NULL != peasycap->frame_buffer[k][m].pgo) { if ((void *)NULL != peasycap->frame_buffer[k][m].pgo) {
free_page((unsigned long)\ free_page((unsigned long)
(peasycap->frame_buffer[k][m].pgo)); (peasycap->frame_buffer[k][m].pgo));
peasycap->frame_buffer[k][m].pgo = (void *)NULL; peasycap->frame_buffer[k][m].pgo = (void *)NULL;
peasycap->allocation_video_page -= 1; peasycap->allocation_video_page -= 1;
...@@ -997,7 +997,7 @@ if ((struct list_head *)NULL != peasycap->purb_audio_head) { ...@@ -997,7 +997,7 @@ if ((struct list_head *)NULL != peasycap->purb_audio_head) {
pdata_urb = list_entry(plist_head, struct data_urb, list_head); pdata_urb = list_entry(plist_head, struct data_urb, list_head);
if ((struct data_urb *)NULL != pdata_urb) { if ((struct data_urb *)NULL != pdata_urb) {
kfree(pdata_urb); pdata_urb = (struct data_urb *)NULL; kfree(pdata_urb); pdata_urb = (struct data_urb *)NULL;
peasycap->allocation_audio_struct -= \ peasycap->allocation_audio_struct -=
sizeof(struct data_urb); sizeof(struct data_urb);
m++; m++;
} }
...@@ -1011,16 +1011,16 @@ JOM(4, "freeing audio isoc buffers.\n"); ...@@ -1011,16 +1011,16 @@ JOM(4, "freeing audio isoc buffers.\n");
m = 0; m = 0;
for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) {
if ((void *)NULL != peasycap->audio_isoc_buffer[k].pgo) { if ((void *)NULL != peasycap->audio_isoc_buffer[k].pgo) {
free_pages((unsigned long)\ free_pages((unsigned long)
(peasycap->audio_isoc_buffer[k].pgo), \ (peasycap->audio_isoc_buffer[k].pgo),
AUDIO_ISOC_ORDER); AUDIO_ISOC_ORDER);
peasycap->audio_isoc_buffer[k].pgo = (void *)NULL; peasycap->audio_isoc_buffer[k].pgo = (void *)NULL;
peasycap->allocation_audio_page -= \ peasycap->allocation_audio_page -=
((unsigned int)(0x01 << AUDIO_ISOC_ORDER)); ((unsigned int)(0x01 << AUDIO_ISOC_ORDER));
m++; m++;
} }
} }
JOM(4, "easyoss_delete(): isoc audio buffers freed: %i pages\n", \ JOM(4, "easyoss_delete(): isoc audio buffers freed: %i pages\n",
m * (0x01 << AUDIO_ISOC_ORDER)); m * (0x01 << AUDIO_ISOC_ORDER));
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if !defined(EASYCAP_NEEDS_ALSA) #if !defined(EASYCAP_NEEDS_ALSA)
...@@ -1133,7 +1133,7 @@ if (0 <= kd && DONGLE_MANY > kd) { ...@@ -1133,7 +1133,7 @@ if (0 <= kd && DONGLE_MANY > kd) {
return -ERESTARTSYS; return -ERESTARTSYS;
} }
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
SAY("ERROR: bad peasycap: 0x%08lX\n", \ SAY("ERROR: bad peasycap: 0x%08lX\n",
(unsigned long int) peasycap); (unsigned long int) peasycap);
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -1220,30 +1220,30 @@ if (0 <= input && INPUT_MANY > input) { ...@@ -1220,30 +1220,30 @@ if (0 <= input && INPUT_MANY > input) {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
miss = 0; miss = 0;
while ((peasycap->field_read == peasycap->field_fill) || \ while ((peasycap->field_read == peasycap->field_fill) ||
(0 != (0xFF00 & peasycap->field_buffer\ (0 != (0xFF00 & peasycap->field_buffer
[peasycap->field_read][0].kount)) || \ [peasycap->field_read][0].kount)) ||
(ifield != (0x00FF & peasycap->field_buffer\ (ifield != (0x00FF & peasycap->field_buffer
[peasycap->field_read][0].kount))) { [peasycap->field_read][0].kount))) {
if (mode) if (mode)
return -EAGAIN; return -EAGAIN;
JOM(8, "first wait on wq_video, " \ JOM(8, "first wait on wq_video, "
"%i=field_read %i=field_fill\n", \ "%i=field_read %i=field_fill\n",
peasycap->field_read, peasycap->field_fill); peasycap->field_read, peasycap->field_fill);
if (0 != (wait_event_interruptible(peasycap->wq_video, \ if (0 != (wait_event_interruptible(peasycap->wq_video,
(peasycap->video_idle || peasycap->video_eof || \ (peasycap->video_idle || peasycap->video_eof ||
((peasycap->field_read != peasycap->field_fill) && \ ((peasycap->field_read != peasycap->field_fill) &&
(0 == (0xFF00 & peasycap->field_buffer\ (0 == (0xFF00 & peasycap->field_buffer
[peasycap->field_read][0].kount)) && \ [peasycap->field_read][0].kount)) &&
(ifield == (0x00FF & peasycap->field_buffer\ (ifield == (0x00FF & peasycap->field_buffer
[peasycap->field_read][0].kount))))))) { [peasycap->field_read][0].kount))))))) {
SAM("aborted by signal\n"); SAM("aborted by signal\n");
return -EIO; return -EIO;
} }
if (peasycap->video_idle) { if (peasycap->video_idle) {
JOM(8, "%i=peasycap->video_idle ... returning -EAGAIN\n", \ JOM(8, "%i=peasycap->video_idle ... returning -EAGAIN\n",
peasycap->video_idle); peasycap->video_idle);
return -EAGAIN; return -EAGAIN;
} }
...@@ -1289,30 +1289,30 @@ if (ifield) ...@@ -1289,30 +1289,30 @@ if (ifield)
else else
ifield = 1; ifield = 1;
miss = 0; miss = 0;
while ((peasycap->field_read == peasycap->field_fill) || \ while ((peasycap->field_read == peasycap->field_fill) ||
(0 != (0xFF00 & peasycap->field_buffer\ (0 != (0xFF00 & peasycap->field_buffer
[peasycap->field_read][0].kount)) || \ [peasycap->field_read][0].kount)) ||
(ifield != (0x00FF & peasycap->field_buffer\ (ifield != (0x00FF & peasycap->field_buffer
[peasycap->field_read][0].kount))) { [peasycap->field_read][0].kount))) {
if (mode) if (mode)
return -EAGAIN; return -EAGAIN;
JOM(8, "second wait on wq_video, " \ JOM(8, "second wait on wq_video, "
"%i=field_read %i=field_fill\n", \ "%i=field_read %i=field_fill\n",
peasycap->field_read, peasycap->field_fill); peasycap->field_read, peasycap->field_fill);
if (0 != (wait_event_interruptible(peasycap->wq_video, \ if (0 != (wait_event_interruptible(peasycap->wq_video,
(peasycap->video_idle || peasycap->video_eof || \ (peasycap->video_idle || peasycap->video_eof ||
((peasycap->field_read != peasycap->field_fill) && \ ((peasycap->field_read != peasycap->field_fill) &&
(0 == (0xFF00 & peasycap->field_buffer\ (0 == (0xFF00 & peasycap->field_buffer
[peasycap->field_read][0].kount)) && \ [peasycap->field_read][0].kount)) &&
(ifield == (0x00FF & peasycap->field_buffer\ (ifield == (0x00FF & peasycap->field_buffer
[peasycap->field_read][0].\ [peasycap->field_read][0].
kount))))))) { kount))))))) {
SAM("aborted by signal\n"); SAM("aborted by signal\n");
return -EIO; return -EIO;
} }
if (peasycap->video_idle) { if (peasycap->video_idle) {
JOM(8, "%i=peasycap->video_idle ... returning -EAGAIN\n", \ JOM(8, "%i=peasycap->video_idle ... returning -EAGAIN\n",
peasycap->video_idle); peasycap->video_idle);
return -EAGAIN; return -EAGAIN;
} }
...@@ -1369,10 +1369,10 @@ if (peasycap->frame_buffer_many <= peasycap->frame_fill) ...@@ -1369,10 +1369,10 @@ if (peasycap->frame_buffer_many <= peasycap->frame_fill)
peasycap->frame_fill = 0; peasycap->frame_fill = 0;
if (0x01 & easycap_standard[peasycap->standard_offset].mask) { if (0x01 & easycap_standard[peasycap->standard_offset].mask) {
peasycap->frame_buffer[peasycap->frame_read][0].kount = \ peasycap->frame_buffer[peasycap->frame_read][0].kount =
V4L2_FIELD_TOP; V4L2_FIELD_TOP;
} else { } else {
peasycap->frame_buffer[peasycap->frame_read][0].kount = \ peasycap->frame_buffer[peasycap->frame_read][0].kount =
V4L2_FIELD_BOTTOM; V4L2_FIELD_BOTTOM;
} }
...@@ -1417,10 +1417,10 @@ if (NULL == peasycap) { ...@@ -1417,10 +1417,10 @@ if (NULL == peasycap) {
badinput = false; badinput = false;
input = 0x07 & peasycap->field_buffer[peasycap->field_read][0].input; input = 0x07 & peasycap->field_buffer[peasycap->field_read][0].input;
JOM(8, "===== parity %i, input 0x%02X, field buffer %i --> " \ JOM(8, "===== parity %i, input 0x%02X, field buffer %i --> "
"frame buffer %i\n", \ "frame buffer %i\n",
peasycap->field_buffer[peasycap->field_read][0].kount,\ peasycap->field_buffer[peasycap->field_read][0].kount,
peasycap->field_buffer[peasycap->field_read][0].input,\ peasycap->field_buffer[peasycap->field_read][0].input,
peasycap->field_read, peasycap->frame_fill); peasycap->field_read, peasycap->frame_fill);
JOM(8, "===== %i=bytesperpixel\n", peasycap->bytesperpixel); JOM(8, "===== %i=bytesperpixel\n", peasycap->bytesperpixel);
if (true == peasycap->offerfields) if (true == peasycap->offerfields)
...@@ -1432,7 +1432,7 @@ if (true == peasycap->offerfields) ...@@ -1432,7 +1432,7 @@ if (true == peasycap->offerfields)
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
if (peasycap->field_read == peasycap->field_fill) { if (peasycap->field_read == peasycap->field_fill) {
SAM("ERROR: on entry, still filling field buffer %i\n", \ SAM("ERROR: on entry, still filling field buffer %i\n",
peasycap->field_read); peasycap->field_read);
return 0; return 0;
} }
...@@ -1450,8 +1450,8 @@ offerfields = peasycap->offerfields; ...@@ -1450,8 +1450,8 @@ offerfields = peasycap->offerfields;
bytesperpixel = peasycap->bytesperpixel; bytesperpixel = peasycap->bytesperpixel;
decimatepixel = peasycap->decimatepixel; decimatepixel = peasycap->decimatepixel;
if ((2 != bytesperpixel) && \ if ((2 != bytesperpixel) &&
(3 != bytesperpixel) && \ (3 != bytesperpixel) &&
(4 != bytesperpixel)) { (4 != bytesperpixel)) {
SAM("MISTAKE: %i=bytesperpixel\n", bytesperpixel); SAM("MISTAKE: %i=bytesperpixel\n", bytesperpixel);
return -EFAULT; return -EFAULT;
...@@ -1462,12 +1462,12 @@ else ...@@ -1462,12 +1462,12 @@ else
multiplier = 1; multiplier = 1;
w2 = 2 * multiplier * (peasycap->width); w2 = 2 * multiplier * (peasycap->width);
w3 = bytesperpixel * \ w3 = bytesperpixel *
multiplier * \ multiplier *
(peasycap->width); (peasycap->width);
wz = multiplier * \ wz = multiplier *
(peasycap->height) * \ (peasycap->height) *
multiplier * \ multiplier *
(peasycap->width); (peasycap->width);
kex = peasycap->field_read; mex = 0; kex = peasycap->field_read; mex = 0;
...@@ -1481,7 +1481,7 @@ else ...@@ -1481,7 +1481,7 @@ else
odd = false; odd = false;
if ((true == odd) && (false == decimatepixel)) { if ((true == odd) && (false == decimatepixel)) {
JOM(8, " initial skipping %4i bytes p.%4i\n", \ JOM(8, " initial skipping %4i bytes p.%4i\n",
w3/multiplier, mad); w3/multiplier, mad);
pad += (w3 / multiplier); rad -= (w3 / multiplier); pad += (w3 / multiplier); rad -= (w3 / multiplier);
} }
...@@ -1510,7 +1510,7 @@ while (cz < wz) { ...@@ -1510,7 +1510,7 @@ while (cz < wz) {
return -EFAULT; return -EFAULT;
} }
more = (bytesperpixel * \ more = (bytesperpixel *
much) / 2; much) / 2;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
if (1 < bytesperpixel) { if (1 < bytesperpixel) {
...@@ -1521,9 +1521,9 @@ while (cz < wz) { ...@@ -1521,9 +1521,9 @@ while (cz < wz) {
** BREAKAGE. BEWARE. ** BREAKAGE. BEWARE.
**/ **/
rad2 = rad + bytesperpixel - 1; rad2 = rad + bytesperpixel - 1;
much = ((((2 * \ much = ((((2 *
rad2)/bytesperpixel)/2) * 2); rad2)/bytesperpixel)/2) * 2);
rump = ((bytesperpixel * \ rump = ((bytesperpixel *
much) / 2) - rad; much) / 2) - rad;
more = rad; more = rad;
} }
...@@ -1531,17 +1531,17 @@ while (cz < wz) { ...@@ -1531,17 +1531,17 @@ while (cz < wz) {
margin = 0; margin = 0;
if (much == rex) { if (much == rex) {
mask |= 0x04; mask |= 0x04;
if ((mex + 1) < FIELD_BUFFER_SIZE/ \ if ((mex + 1) < FIELD_BUFFER_SIZE/
PAGE_SIZE) { PAGE_SIZE) {
margin = *((__u8 *)(peasycap->\ margin = *((__u8 *)(peasycap->
field_buffer\ field_buffer
[kex][mex + 1].pgo)); [kex][mex + 1].pgo));
} else } else
mask |= 0x08; mask |= 0x08;
} }
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
} else { } else {
SAM("MISTAKE: %i=bytesperpixel\n", \ SAM("MISTAKE: %i=bytesperpixel\n",
bytesperpixel); bytesperpixel);
return -EFAULT; return -EFAULT;
} }
...@@ -1549,14 +1549,14 @@ while (cz < wz) { ...@@ -1549,14 +1549,14 @@ while (cz < wz) {
if (rump) if (rump)
caches++; caches++;
if (true == badinput) { if (true == badinput) {
JOM(8, "ERROR: 0x%02X=->field_buffer" \ JOM(8, "ERROR: 0x%02X=->field_buffer"
"[%i][%i].input, " \ "[%i][%i].input, "
"0x%02X=(0x08|->input)\n", \ "0x%02X=(0x08|->input)\n",
peasycap->field_buffer\ peasycap->field_buffer
[kex][mex].input, kex, mex, \ [kex][mex].input, kex, mex,
(0x08|peasycap->input)); (0x08|peasycap->input));
} }
rc = redaub(peasycap, pad, pex, much, more, \ rc = redaub(peasycap, pad, pex, much, more,
mask, margin, isuy); mask, margin, isuy);
if (0 > rc) { if (0 > rc) {
SAM("ERROR: redaub() failed\n"); SAM("ERROR: redaub() failed\n");
...@@ -1574,7 +1574,7 @@ while (cz < wz) { ...@@ -1574,7 +1574,7 @@ while (cz < wz) {
mex++; mex++;
pex = peasycap->field_buffer[kex][mex].pgo; pex = peasycap->field_buffer[kex][mex].pgo;
rex = PAGE_SIZE; rex = PAGE_SIZE;
if (peasycap->field_buffer[kex][mex].input != \ if (peasycap->field_buffer[kex][mex].input !=
(0x08|peasycap->input)) (0x08|peasycap->input))
badinput = true; badinput = true;
} }
...@@ -1601,7 +1601,7 @@ while (cz < wz) { ...@@ -1601,7 +1601,7 @@ while (cz < wz) {
do { do {
if (!rad) { if (!rad) {
mad++; mad++;
pad = peasycap->frame_buffer\ pad = peasycap->frame_buffer
[kad][mad].pgo; [kad][mad].pgo;
rad = PAGE_SIZE; rad = PAGE_SIZE;
} }
...@@ -1634,7 +1634,7 @@ while (cz < wz) { ...@@ -1634,7 +1634,7 @@ while (cz < wz) {
return -EFAULT; return -EFAULT;
} }
more = (bytesperpixel * \ more = (bytesperpixel *
much) / 4; much) / 4;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
if (1 < bytesperpixel) { if (1 < bytesperpixel) {
...@@ -1645,9 +1645,9 @@ while (cz < wz) { ...@@ -1645,9 +1645,9 @@ while (cz < wz) {
** BREAKAGE. BEWARE. ** BREAKAGE. BEWARE.
**/ **/
rad2 = rad + bytesperpixel - 1; rad2 = rad + bytesperpixel - 1;
much = ((((2 * rad2)/bytesperpixel)/2)\ much = ((((2 * rad2)/bytesperpixel)/2)
* 4); * 4);
rump = ((bytesperpixel * \ rump = ((bytesperpixel *
much) / 4) - rad; much) / 4) - rad;
more = rad; more = rad;
} }
...@@ -1655,10 +1655,10 @@ while (cz < wz) { ...@@ -1655,10 +1655,10 @@ while (cz < wz) {
margin = 0; margin = 0;
if (much == rex) { if (much == rex) {
mask |= 0x04; mask |= 0x04;
if ((mex + 1) < FIELD_BUFFER_SIZE/ \ if ((mex + 1) < FIELD_BUFFER_SIZE/
PAGE_SIZE) { PAGE_SIZE) {
margin = *((__u8 *)(peasycap->\ margin = *((__u8 *)(peasycap->
field_buffer\ field_buffer
[kex][mex + 1].pgo)); [kex][mex + 1].pgo));
} }
else else
...@@ -1666,7 +1666,7 @@ while (cz < wz) { ...@@ -1666,7 +1666,7 @@ while (cz < wz) {
} }
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
} else { } else {
SAM("MISTAKE: %i=bytesperpixel\n", \ SAM("MISTAKE: %i=bytesperpixel\n",
bytesperpixel); bytesperpixel);
return -EFAULT; return -EFAULT;
} }
...@@ -1675,14 +1675,14 @@ while (cz < wz) { ...@@ -1675,14 +1675,14 @@ while (cz < wz) {
caches++; caches++;
if (true == badinput) { if (true == badinput) {
JOM(8, "ERROR: 0x%02X=->field_buffer" \ JOM(8, "ERROR: 0x%02X=->field_buffer"
"[%i][%i].input, " \ "[%i][%i].input, "
"0x%02X=(0x08|->input)\n", \ "0x%02X=(0x08|->input)\n",
peasycap->field_buffer\ peasycap->field_buffer
[kex][mex].input, kex, mex, \ [kex][mex].input, kex, mex,
(0x08|peasycap->input)); (0x08|peasycap->input));
} }
rc = redaub(peasycap, pad, pex, much, more, \ rc = redaub(peasycap, pad, pex, much, more,
mask, margin, isuy); mask, margin, isuy);
if (0 > rc) { if (0 > rc) {
SAM("ERROR: redaub() failed\n"); SAM("ERROR: redaub() failed\n");
...@@ -1694,7 +1694,7 @@ while (cz < wz) { ...@@ -1694,7 +1694,7 @@ while (cz < wz) {
mex++; mex++;
pex = peasycap->field_buffer[kex][mex].pgo; pex = peasycap->field_buffer[kex][mex].pgo;
rex = PAGE_SIZE; rex = PAGE_SIZE;
if (peasycap->field_buffer[kex][mex].input != \ if (peasycap->field_buffer[kex][mex].input !=
(0x08|peasycap->input)) (0x08|peasycap->input))
badinput = true; badinput = true;
} }
...@@ -1723,13 +1723,13 @@ while (cz < wz) { ...@@ -1723,13 +1723,13 @@ while (cz < wz) {
mex++; mex++;
pex = peasycap->field_buffer[kex][mex].pgo; pex = peasycap->field_buffer[kex][mex].pgo;
rex = PAGE_SIZE; rex = PAGE_SIZE;
if (peasycap->field_buffer[kex][mex].input != \ if (peasycap->field_buffer[kex][mex].input !=
(0x08|peasycap->input)) { (0x08|peasycap->input)) {
JOM(8, "ERROR: 0x%02X=->field_buffer"\ JOM(8, "ERROR: 0x%02X=->field_buffer"
"[%i][%i].input, " \ "[%i][%i].input, "
"0x%02X=(0x08|->input)\n", \ "0x%02X=(0x08|->input)\n",
peasycap->field_buffer\ peasycap->field_buffer
[kex][mex].input, kex, mex, \ [kex][mex].input, kex, mex,
(0x08|peasycap->input)); (0x08|peasycap->input));
badinput = true; badinput = true;
} }
...@@ -1755,21 +1755,21 @@ if (cz != c2) ...@@ -1755,21 +1755,21 @@ if (cz != c2)
c3 = (mad + 1)*PAGE_SIZE - rad; c3 = (mad + 1)*PAGE_SIZE - rad;
if (false == decimatepixel) { if (false == decimatepixel) {
if (bytesperpixel * \ if (bytesperpixel *
cz != c3) \ cz != c3)
SAM("ERROR: discrepancy %i in bytes written\n", \ SAM("ERROR: discrepancy %i in bytes written\n",
c3 - (bytesperpixel * \ c3 - (bytesperpixel *
cz)); cz));
} else { } else {
if (false == odd) { if (false == odd) {
if (bytesperpixel * \ if (bytesperpixel *
cz != (4 * c3)) cz != (4 * c3))
SAM("ERROR: discrepancy %i in bytes written\n", \ SAM("ERROR: discrepancy %i in bytes written\n",
(2*c3)-(bytesperpixel * \ (2*c3)-(bytesperpixel *
cz)); cz));
} else { } else {
if (0 != c3) if (0 != c3)
SAM("ERROR: discrepancy %i " \ SAM("ERROR: discrepancy %i "
"in bytes written\n", c3); "in bytes written\n", c3);
} }
} }
...@@ -1783,7 +1783,7 @@ if (true == odd) ...@@ -1783,7 +1783,7 @@ if (true == odd)
JOM(8, "+++++ field2frame(): frame buffer %i is full\n", kad); JOM(8, "+++++ field2frame(): frame buffer %i is full\n", kad);
if (peasycap->field_read == peasycap->field_fill) if (peasycap->field_read == peasycap->field_fill)
SAM("WARNING: on exit, filling field buffer %i\n", \ SAM("WARNING: on exit, filling field buffer %i\n",
peasycap->field_read); peasycap->field_read);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
...@@ -1792,9 +1792,9 @@ if (peasycap->field_read == peasycap->field_fill) ...@@ -1792,9 +1792,9 @@ if (peasycap->field_read == peasycap->field_fill)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
do_gettimeofday(&timeval); do_gettimeofday(&timeval);
if (peasycap->timeval6.tv_sec) { if (peasycap->timeval6.tv_sec) {
below = ((long long int)(1000000)) * \ below = ((long long int)(1000000)) *
((long long int)(timeval.tv_sec - \ ((long long int)(timeval.tv_sec -
peasycap->timeval6.tv_sec)) + \ peasycap->timeval6.tv_sec)) +
(long long int)(timeval.tv_usec - peasycap->timeval6.tv_usec); (long long int)(timeval.tv_usec - peasycap->timeval6.tv_usec);
above = (long long int)1000000; above = (long long int)1000000;
...@@ -1802,7 +1802,7 @@ if (peasycap->timeval6.tv_sec) { ...@@ -1802,7 +1802,7 @@ if (peasycap->timeval6.tv_sec) {
above = sdr.quotient; above = sdr.quotient;
remainder = (__u32)sdr.remainder; remainder = (__u32)sdr.remainder;
JOM(8, "video streaming at %3lli.%03i fields per second\n", above, \ JOM(8, "video streaming at %3lli.%03i fields per second\n", above,
(remainder/1000)); (remainder/1000));
} }
peasycap->timeval6 = timeval; peasycap->timeval6 = timeval;
...@@ -1857,7 +1857,7 @@ return sdr; ...@@ -1857,7 +1857,7 @@ return sdr;
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
redaub(struct easycap *peasycap, void *pad, void *pex, int much, int more, \ redaub(struct easycap *peasycap, void *pad, void *pex, int much, int more,
__u8 mask, __u8 margin, bool isuy) __u8 mask, __u8 margin, bool isuy)
{ {
static __s32 ay[256], bu[256], rv[256], gu[256], gv[256]; static __s32 ay[256], bu[256], rv[256], gu[256], gv[256];
...@@ -2037,13 +2037,13 @@ case 3: ...@@ -2037,13 +2037,13 @@ case 3:
} }
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - gv[(int)v]; s32 = ay[(int)y] - gu[(int)u] - gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2062,7 +2062,7 @@ case 3: ...@@ -2062,7 +2062,7 @@ case 3:
break; break;
} }
default: { default: {
SAM("MISTAKE: %i=rump\n", \ SAM("MISTAKE: %i=rump\n",
bytesperpixel - rump); bytesperpixel - rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2110,13 +2110,13 @@ case 3: ...@@ -2110,13 +2110,13 @@ case 3:
} }
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - gv[(int)v]; s32 = ay[(int)y] - gu[(int)u] - gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2135,7 +2135,7 @@ case 3: ...@@ -2135,7 +2135,7 @@ case 3:
break; break;
} }
default: { default: {
SAM("MISTAKE: %i=rump\n", \ SAM("MISTAKE: %i=rump\n",
bytesperpixel - rump); bytesperpixel - rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2185,14 +2185,14 @@ case 3: ...@@ -2185,14 +2185,14 @@ case 3:
if (true == isuy) { if (true == isuy) {
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - \ s32 = ay[(int)y] - gu[(int)u] -
gv[(int)v]; gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2211,8 +2211,8 @@ case 3: ...@@ -2211,8 +2211,8 @@ case 3:
break; break;
} }
default: { default: {
SAM("MISTAKE: " \ SAM("MISTAKE: "
"%i=rump\n", \ "%i=rump\n",
bytesperpixel - rump); bytesperpixel - rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2261,14 +2261,14 @@ case 3: ...@@ -2261,14 +2261,14 @@ case 3:
if (true == isuy) { if (true == isuy) {
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - \ s32 = ay[(int)y] - gu[(int)u] -
gv[(int)v]; gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2287,8 +2287,8 @@ case 3: ...@@ -2287,8 +2287,8 @@ case 3:
break; break;
} }
default: { default: {
SAM("MISTAKE: " \ SAM("MISTAKE: "
"%i=rump\n", \ "%i=rump\n",
bytesperpixel - rump); bytesperpixel - rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2342,13 +2342,13 @@ case 4: ...@@ -2342,13 +2342,13 @@ case 4:
} }
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - gv[(int)v]; s32 = ay[(int)y] - gu[(int)u] - gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2376,7 +2376,7 @@ case 4: ...@@ -2376,7 +2376,7 @@ case 4:
break; break;
} }
default: { default: {
SAM("MISTAKE: %i=rump\n", \ SAM("MISTAKE: %i=rump\n",
bytesperpixel - rump); bytesperpixel - rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2424,13 +2424,13 @@ case 4: ...@@ -2424,13 +2424,13 @@ case 4:
} }
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - gv[(int)v]; s32 = ay[(int)y] - gu[(int)u] - gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2458,7 +2458,7 @@ case 4: ...@@ -2458,7 +2458,7 @@ case 4:
break; break;
} }
default: { default: {
SAM("MISTAKE: %i=rump\n", \ SAM("MISTAKE: %i=rump\n",
bytesperpixel - rump); bytesperpixel - rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2510,14 +2510,14 @@ case 4: ...@@ -2510,14 +2510,14 @@ case 4:
if (true == isuy) { if (true == isuy) {
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - \ s32 = ay[(int)y] - gu[(int)u] -
gv[(int)v]; gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2545,9 +2545,9 @@ case 4: ...@@ -2545,9 +2545,9 @@ case 4:
break; break;
} }
default: { default: {
SAM("MISTAKE: " \ SAM("MISTAKE: "
"%i=rump\n", \ "%i=rump\n",
bytesperpixel - \ bytesperpixel -
rump); rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2595,14 +2595,14 @@ case 4: ...@@ -2595,14 +2595,14 @@ case 4:
if (true == isuy) { if (true == isuy) {
s32 = ay[(int)y] + rv[(int)v]; s32 = ay[(int)y] + rv[(int)v];
r = (255 < s32) ? 255 : ((0 > s32) ? \ r = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] - gu[(int)u] - \ s32 = ay[(int)y] - gu[(int)u] -
gv[(int)v]; gv[(int)v];
g = (255 < s32) ? 255 : ((0 > s32) ? \ g = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
s32 = ay[(int)y] + bu[(int)u]; s32 = ay[(int)y] + bu[(int)u];
b = (255 < s32) ? 255 : ((0 > s32) ? \ b = (255 < s32) ? 255 : ((0 > s32) ?
0 : (__u8)s32); 0 : (__u8)s32);
if ((true == last) && rump) { if ((true == last) && rump) {
...@@ -2630,8 +2630,8 @@ case 4: ...@@ -2630,8 +2630,8 @@ case 4:
break; break;
} }
default: { default: {
SAM("MISTAKE: " \ SAM("MISTAKE: "
"%i=rump\n", \ "%i=rump\n",
bytesperpixel - rump); bytesperpixel - rump);
return -EFAULT; return -EFAULT;
} }
...@@ -2840,16 +2840,16 @@ for (i = 0; i < VIDEO_ISOC_BUFFER_MANY; i++) ...@@ -2840,16 +2840,16 @@ for (i = 0; i < VIDEO_ISOC_BUFFER_MANY; i++)
break; break;
JOM(16, "%2i=urb\n", i); JOM(16, "%2i=urb\n", i);
last = peasycap->video_isoc_sequence; last = peasycap->video_isoc_sequence;
if ((((VIDEO_ISOC_BUFFER_MANY - 1) == last) && \ if ((((VIDEO_ISOC_BUFFER_MANY - 1) == last) &&
(0 != i)) || \ (0 != i)) ||
(((VIDEO_ISOC_BUFFER_MANY - 1) != last) && \ (((VIDEO_ISOC_BUFFER_MANY - 1) != last) &&
((last + 1) != i))) { ((last + 1) != i))) {
JOM(16, "ERROR: out-of-order urbs %i,%i ... continuing\n", last, i); JOM(16, "ERROR: out-of-order urbs %i,%i ... continuing\n", last, i);
} }
peasycap->video_isoc_sequence = i; peasycap->video_isoc_sequence = i;
if (peasycap->video_idle) { if (peasycap->video_idle) {
JOM(16, "%i=video_idle %i=video_isoc_streaming\n", \ JOM(16, "%i=video_idle %i=video_isoc_streaming\n",
peasycap->video_idle, peasycap->video_isoc_streaming); peasycap->video_idle, peasycap->video_isoc_streaming);
if (peasycap->video_isoc_streaming) { if (peasycap->video_isoc_streaming) {
rc = usb_submit_urb(purb, GFP_ATOMIC); rc = usb_submit_urb(purb, GFP_ATOMIC);
...@@ -2896,10 +2896,10 @@ if (peasycap->video_idle) { ...@@ -2896,10 +2896,10 @@ if (peasycap->video_idle) {
break; break;
} }
} }
if (-ENODEV != rc) \ if (-ENODEV != rc)
SAM("ERROR: while %i=video_idle, " \ SAM("ERROR: while %i=video_idle, "
"usb_submit_urb() " \ "usb_submit_urb() "
"failed with rc:\n", \ "failed with rc:\n",
peasycap->video_idle); peasycap->video_idle);
} }
} }
...@@ -2988,7 +2988,7 @@ if (purb->status) { ...@@ -2988,7 +2988,7 @@ if (purb->status) {
} else { } else {
for (i = 0; i < purb->number_of_packets; i++) { for (i = 0; i < purb->number_of_packets; i++) {
if (0 != purb->iso_frame_desc[i].status) { if (0 != purb->iso_frame_desc[i].status) {
(peasycap->field_buffer\ (peasycap->field_buffer
[peasycap->field_fill][0].kount) |= 0x8000 ; [peasycap->field_fill][0].kount) |= 0x8000 ;
switch (purb->iso_frame_desc[i].status) { switch (purb->iso_frame_desc[i].status) {
case 0: { case 0: {
...@@ -3055,24 +3055,24 @@ if (purb->status) { ...@@ -3055,24 +3055,24 @@ if (purb->status) {
frameactual = purb->iso_frame_desc[i].actual_length; frameactual = purb->iso_frame_desc[i].actual_length;
frameoffset = purb->iso_frame_desc[i].offset; frameoffset = purb->iso_frame_desc[i].offset;
JOM(16, "frame[%2i]:" \ JOM(16, "frame[%2i]:"
"%4i=status " \ "%4i=status "
"%4i=actual " \ "%4i=actual "
"%4i=length " \ "%4i=length "
"%5i=offset\n", \ "%5i=offset\n",
i, framestatus, frameactual, framelength, frameoffset); i, framestatus, frameactual, framelength, frameoffset);
if (!purb->iso_frame_desc[i].status) { if (!purb->iso_frame_desc[i].status) {
more = purb->iso_frame_desc[i].actual_length; more = purb->iso_frame_desc[i].actual_length;
pfield_buffer = &peasycap->field_buffer\ pfield_buffer = &peasycap->field_buffer
[peasycap->field_fill][peasycap->field_page]; [peasycap->field_fill][peasycap->field_page];
videofieldamount = (peasycap->field_page * \ videofieldamount = (peasycap->field_page *
PAGE_SIZE) + \ PAGE_SIZE) +
(int)(pfield_buffer->pto - pfield_buffer->pgo); (int)(pfield_buffer->pto - pfield_buffer->pgo);
if (4 == more) if (4 == more)
peasycap->video_mt++; peasycap->video_mt++;
if (4 < more) { if (4 < more) {
if (peasycap->video_mt) { if (peasycap->video_mt) {
JOM(8, "%4i empty video urb frames\n", \ JOM(8, "%4i empty video urb frames\n",
peasycap->video_mt); peasycap->video_mt);
peasycap->video_mt = 0; peasycap->video_mt = 0;
} }
...@@ -3080,14 +3080,14 @@ if (purb->status) { ...@@ -3080,14 +3080,14 @@ if (purb->status) {
SAM("ERROR: bad peasycap->field_fill\n"); SAM("ERROR: bad peasycap->field_fill\n");
return; return;
} }
if (FIELD_BUFFER_SIZE/PAGE_SIZE <= \ if (FIELD_BUFFER_SIZE/PAGE_SIZE <=
peasycap->field_page) { peasycap->field_page) {
SAM("ERROR: bad peasycap->field_page\n"); SAM("ERROR: bad peasycap->field_page\n");
return; return;
} }
pfield_buffer = &peasycap->field_buffer\ pfield_buffer = &peasycap->field_buffer
[peasycap->field_fill][peasycap->field_page]; [peasycap->field_fill][peasycap->field_page];
pu = (__u8 *)(purb->transfer_buffer + \ pu = (__u8 *)(purb->transfer_buffer +
purb->iso_frame_desc[i].offset); purb->iso_frame_desc[i].offset);
if (0x80 & *pu) if (0x80 & *pu)
leap = 8; leap = 8;
...@@ -3111,124 +3111,124 @@ if (purb->status) { ...@@ -3111,124 +3111,124 @@ if (purb->status) {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
if ((8 == more) || override) { if ((8 == more) || override) {
if (videofieldamount > \ if (videofieldamount >
peasycap->videofieldamount) { peasycap->videofieldamount) {
if (2 == videofieldamount - \ if (2 == videofieldamount -
peasycap->\ peasycap->
videofieldamount) { videofieldamount) {
(peasycap->field_buffer\ (peasycap->field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[0].kount) |= 0x0100; [0].kount) |= 0x0100;
peasycap->video_junk += (1 + \ peasycap->video_junk += (1 +
VIDEO_JUNK_TOLERATE); VIDEO_JUNK_TOLERATE);
} else } else
(peasycap->field_buffer\ (peasycap->field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[0].kount) |= 0x4000; [0].kount) |= 0x4000;
} else if (videofieldamount < \ } else if (videofieldamount <
peasycap->\ peasycap->
videofieldamount) { videofieldamount) {
(peasycap->field_buffer\ (peasycap->field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[0].kount) |= 0x2000; [0].kount) |= 0x2000;
} }
bad = 0xFF00 & peasycap->field_buffer\ bad = 0xFF00 & peasycap->field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[0].kount; [0].kount;
if (!bad) { if (!bad) {
(peasycap->video_junk)--; (peasycap->video_junk)--;
if (-VIDEO_JUNK_TOLERATE > \ if (-VIDEO_JUNK_TOLERATE >
peasycap->video_junk) \ peasycap->video_junk)
peasycap->video_junk =\ peasycap->video_junk =
-VIDEO_JUNK_TOLERATE; -VIDEO_JUNK_TOLERATE;
peasycap->field_read = \ peasycap->field_read =
(peasycap->\ (peasycap->
field_fill)++; field_fill)++;
if (FIELD_BUFFER_MANY <= \ if (FIELD_BUFFER_MANY <=
peasycap->\ peasycap->
field_fill) field_fill)
peasycap->\ peasycap->
field_fill = 0; field_fill = 0;
peasycap->field_page = 0; peasycap->field_page = 0;
pfield_buffer = &peasycap->\ pfield_buffer = &peasycap->
field_buffer\ field_buffer
[peasycap->\ [peasycap->
field_fill]\ field_fill]
[peasycap->\ [peasycap->
field_page]; field_page];
pfield_buffer->pto = \ pfield_buffer->pto =
pfield_buffer->pgo; pfield_buffer->pgo;
JOM(8, "bumped to: %i="\ JOM(8, "bumped to: %i="
"peasycap->" \ "peasycap->"
"field_fill %i="\ "field_fill %i="
"parity\n", \ "parity\n",
peasycap->field_fill, \ peasycap->field_fill,
0x00FF & \ 0x00FF &
pfield_buffer->kount); pfield_buffer->kount);
JOM(8, "field buffer %i has "\ JOM(8, "field buffer %i has "
"%i bytes fit to be "\ "%i bytes fit to be "
"read\n", \ "read\n",
peasycap->field_read, \ peasycap->field_read,
videofieldamount); videofieldamount);
JOM(8, "wakeup call to "\ JOM(8, "wakeup call to "
"wq_video, " \ "wq_video, "
"%i=field_read "\ "%i=field_read "
"%i=field_fill "\ "%i=field_fill "
"%i=parity\n", \ "%i=parity\n",
peasycap->field_read, \ peasycap->field_read,
peasycap->field_fill, \ peasycap->field_fill,
0x00FF & peasycap->\ 0x00FF & peasycap->
field_buffer\ field_buffer
[peasycap->\ [peasycap->
field_read][0].kount); field_read][0].kount);
wake_up_interruptible\ wake_up_interruptible
(&(peasycap->\ (&(peasycap->
wq_video)); wq_video));
do_gettimeofday\ do_gettimeofday
(&peasycap->timeval7); (&peasycap->timeval7);
} else { } else {
peasycap->video_junk++; peasycap->video_junk++;
if (bad & 0x0010) \ if (bad & 0x0010)
peasycap->video_junk += \ peasycap->video_junk +=
(1 + VIDEO_JUNK_TOLERATE/2); (1 + VIDEO_JUNK_TOLERATE/2);
JOM(8, "field buffer %i had %i " \ JOM(8, "field buffer %i had %i "
"bytes, now discarded: "\ "bytes, now discarded: "
"0x%04X\n", \ "0x%04X\n",
peasycap->field_fill, \ peasycap->field_fill,
videofieldamount,\ videofieldamount,
(0xFF00 & \ (0xFF00 &
peasycap->field_buffer\ peasycap->field_buffer
[peasycap->field_fill][0].\ [peasycap->field_fill][0].
kount)); kount));
(peasycap->field_fill)++; (peasycap->field_fill)++;
if (FIELD_BUFFER_MANY <= \ if (FIELD_BUFFER_MANY <=
peasycap->field_fill) peasycap->field_fill)
peasycap->field_fill = 0; peasycap->field_fill = 0;
peasycap->field_page = 0; peasycap->field_page = 0;
pfield_buffer = \ pfield_buffer =
&peasycap->field_buffer\ &peasycap->field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[peasycap->field_page]; [peasycap->field_page];
pfield_buffer->pto = \ pfield_buffer->pto =
pfield_buffer->pgo; pfield_buffer->pgo;
JOM(8, "bumped to: %i=peasycap->" \ JOM(8, "bumped to: %i=peasycap->"
"field_fill %i=parity\n", \ "field_fill %i=parity\n",
peasycap->field_fill, \ peasycap->field_fill,
0x00FF & pfield_buffer->kount); 0x00FF & pfield_buffer->kount);
} }
if (8 == more) { if (8 == more) {
JOM(8, "end-of-field: received " \ JOM(8, "end-of-field: received "
"parity byte 0x%02X\n", \ "parity byte 0x%02X\n",
(0xFF & *pu)); (0xFF & *pu));
if (0x40 & *pu) if (0x40 & *pu)
pfield_buffer->kount = 0x0000; pfield_buffer->kount = 0x0000;
else else
pfield_buffer->kount = 0x0001; pfield_buffer->kount = 0x0001;
pfield_buffer->input = 0x08 | \ pfield_buffer->input = 0x08 |
(0x07 & peasycap->input); (0x07 & peasycap->input);
JOM(8, "end-of-field: 0x%02X=kount\n",\ JOM(8, "end-of-field: 0x%02X=kount\n",
0xFF & pfield_buffer->kount); 0xFF & pfield_buffer->kount);
} }
} }
...@@ -3244,49 +3244,49 @@ if (purb->status) { ...@@ -3244,49 +3244,49 @@ if (purb->status) {
SAM("ERROR: bad peasycap->field_fill\n"); SAM("ERROR: bad peasycap->field_fill\n");
return; return;
} }
if (FIELD_BUFFER_SIZE/PAGE_SIZE <= \ if (FIELD_BUFFER_SIZE/PAGE_SIZE <=
peasycap->field_page) { peasycap->field_page) {
SAM("ERROR: bad peasycap->field_page\n"); SAM("ERROR: bad peasycap->field_page\n");
return; return;
} }
pfield_buffer = &peasycap->field_buffer\ pfield_buffer = &peasycap->field_buffer
[peasycap->field_fill][peasycap->field_page]; [peasycap->field_fill][peasycap->field_page];
while (more) { while (more) {
pfield_buffer = &peasycap->field_buffer\ pfield_buffer = &peasycap->field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[peasycap->field_page]; [peasycap->field_page];
if (PAGE_SIZE < (pfield_buffer->pto - \ if (PAGE_SIZE < (pfield_buffer->pto -
pfield_buffer->pgo)) { pfield_buffer->pgo)) {
SAM("ERROR: bad pfield_buffer->pto\n"); SAM("ERROR: bad pfield_buffer->pto\n");
return; return;
} }
if (PAGE_SIZE == (pfield_buffer->pto - \ if (PAGE_SIZE == (pfield_buffer->pto -
pfield_buffer->pgo)) { pfield_buffer->pgo)) {
(peasycap->field_page)++; (peasycap->field_page)++;
if (FIELD_BUFFER_SIZE/PAGE_SIZE <= \ if (FIELD_BUFFER_SIZE/PAGE_SIZE <=
peasycap->field_page) { peasycap->field_page) {
JOM(16, "wrapping peasycap->" \ JOM(16, "wrapping peasycap->"
"field_page\n"); "field_page\n");
peasycap->field_page = 0; peasycap->field_page = 0;
} }
pfield_buffer = &peasycap->\ pfield_buffer = &peasycap->
field_buffer\ field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[peasycap->field_page]; [peasycap->field_page];
pfield_buffer->pto = \ pfield_buffer->pto =
pfield_buffer->pgo; pfield_buffer->pgo;
pfield_buffer->input = 0x08 | \ pfield_buffer->input = 0x08 |
(0x07 & peasycap->input); (0x07 & peasycap->input);
if ((peasycap->field_buffer[peasycap->\ if ((peasycap->field_buffer[peasycap->
field_fill][0]).\ field_fill][0]).
input != \ input !=
pfield_buffer->input) pfield_buffer->input)
(peasycap->field_buffer\ (peasycap->field_buffer
[peasycap->field_fill]\ [peasycap->field_fill]
[0]).kount |= 0x1000; [0]).kount |= 0x1000;
} }
much = PAGE_SIZE - (int)(pfield_buffer->pto - \ much = PAGE_SIZE - (int)(pfield_buffer->pto -
pfield_buffer->pgo); pfield_buffer->pgo);
if (much > more) if (much > more)
...@@ -3355,10 +3355,10 @@ if (peasycap->video_isoc_streaming) { ...@@ -3355,10 +3355,10 @@ if (peasycap->video_isoc_streaming) {
SAM("0x%08X\n", rc); break; SAM("0x%08X\n", rc); break;
} }
} }
if (-ENODEV != rc) \ if (-ENODEV != rc)
SAM("ERROR: while %i=video_idle, " \ SAM("ERROR: while %i=video_idle, "
"usb_submit_urb() " \ "usb_submit_urb() "
"failed with rc:\n", \ "failed with rc:\n",
peasycap->video_idle); peasycap->video_idle);
} }
} }
...@@ -3372,7 +3372,7 @@ return; ...@@ -3372,7 +3372,7 @@ return;
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
easycap_usb_probe(struct usb_interface *pusb_interface, \ easycap_usb_probe(struct usb_interface *pusb_interface,
const struct usb_device_id *pusb_device_id) const struct usb_device_id *pusb_device_id)
{ {
struct usb_device *pusb_device, *pusb_device1; struct usb_device *pusb_device, *pusb_device1;
...@@ -3424,7 +3424,7 @@ peasycap = (struct easycap *)NULL; ...@@ -3424,7 +3424,7 @@ peasycap = (struct easycap *)NULL;
* GET POINTER TO STRUCTURE usb_device * GET POINTER TO STRUCTURE usb_device
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
pusb_device1 = container_of(pusb_interface->dev.parent, \ pusb_device1 = container_of(pusb_interface->dev.parent,
struct usb_device, dev); struct usb_device, dev);
if ((struct usb_device *)NULL == pusb_device1) { if ((struct usb_device *)NULL == pusb_device1) {
SAY("ERROR: pusb_device1 is NULL\n"); SAY("ERROR: pusb_device1 is NULL\n");
...@@ -3460,23 +3460,23 @@ bInterfaceNumber = pusb_interface_descriptor->bInterfaceNumber; ...@@ -3460,23 +3460,23 @@ bInterfaceNumber = pusb_interface_descriptor->bInterfaceNumber;
bInterfaceClass = pusb_interface_descriptor->bInterfaceClass; bInterfaceClass = pusb_interface_descriptor->bInterfaceClass;
bInterfaceSubClass = pusb_interface_descriptor->bInterfaceSubClass; bInterfaceSubClass = pusb_interface_descriptor->bInterfaceSubClass;
JOT(4, "intf[%i]: pusb_interface->num_altsetting=%i\n", \ JOT(4, "intf[%i]: pusb_interface->num_altsetting=%i\n",
bInterfaceNumber, pusb_interface->num_altsetting); bInterfaceNumber, pusb_interface->num_altsetting);
JOT(4, "intf[%i]: pusb_interface->cur_altsetting - " \ JOT(4, "intf[%i]: pusb_interface->cur_altsetting - "
"pusb_interface->altsetting=%li\n", bInterfaceNumber, \ "pusb_interface->altsetting=%li\n", bInterfaceNumber,
(long int)(pusb_interface->cur_altsetting - \ (long int)(pusb_interface->cur_altsetting -
pusb_interface->altsetting)); pusb_interface->altsetting));
switch (bInterfaceClass) { switch (bInterfaceClass) {
case USB_CLASS_AUDIO: { case USB_CLASS_AUDIO: {
JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_AUDIO\n", \ JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_AUDIO\n",
bInterfaceNumber, bInterfaceClass); break; bInterfaceNumber, bInterfaceClass); break;
} }
case USB_CLASS_VIDEO: { case USB_CLASS_VIDEO: {
JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VIDEO\n", \ JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VIDEO\n",
bInterfaceNumber, bInterfaceClass); break; bInterfaceNumber, bInterfaceClass); break;
} }
case USB_CLASS_VENDOR_SPEC: { case USB_CLASS_VENDOR_SPEC: {
JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VENDOR_SPEC\n", \ JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VENDOR_SPEC\n",
bInterfaceNumber, bInterfaceClass); break; bInterfaceNumber, bInterfaceClass); break;
} }
default: default:
...@@ -3484,15 +3484,15 @@ case USB_CLASS_VENDOR_SPEC: { ...@@ -3484,15 +3484,15 @@ case USB_CLASS_VENDOR_SPEC: {
} }
switch (bInterfaceSubClass) { switch (bInterfaceSubClass) {
case 0x01: { case 0x01: {
JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOCONTROL\n", \ JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOCONTROL\n",
bInterfaceNumber, bInterfaceSubClass); break; bInterfaceNumber, bInterfaceSubClass); break;
} }
case 0x02: { case 0x02: {
JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOSTREAMING\n", \ JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOSTREAMING\n",
bInterfaceNumber, bInterfaceSubClass); break; bInterfaceNumber, bInterfaceSubClass); break;
} }
case 0x03: { case 0x03: {
JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=MIDISTREAMING\n", \ JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=MIDISTREAMING\n",
bInterfaceNumber, bInterfaceSubClass); break; bInterfaceNumber, bInterfaceSubClass); break;
} }
default: default:
...@@ -3501,12 +3501,12 @@ case 0x03: { ...@@ -3501,12 +3501,12 @@ case 0x03: {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
pusb_interface_assoc_descriptor = pusb_interface->intf_assoc; pusb_interface_assoc_descriptor = pusb_interface->intf_assoc;
if (NULL != pusb_interface_assoc_descriptor) { if (NULL != pusb_interface_assoc_descriptor) {
JOT(4, "intf[%i]: bFirstInterface=0x%02X bInterfaceCount=0x%02X\n", \ JOT(4, "intf[%i]: bFirstInterface=0x%02X bInterfaceCount=0x%02X\n",
bInterfaceNumber, \ bInterfaceNumber,
pusb_interface_assoc_descriptor->bFirstInterface, \ pusb_interface_assoc_descriptor->bFirstInterface,
pusb_interface_assoc_descriptor->bInterfaceCount); pusb_interface_assoc_descriptor->bInterfaceCount);
} else { } else {
JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n", \ JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n",
bInterfaceNumber); bInterfaceNumber);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -3529,10 +3529,10 @@ if (0 == bInterfaceNumber) { ...@@ -3529,10 +3529,10 @@ if (0 == bInterfaceNumber) {
SAM("allocated 0x%08lX=peasycap\n", (unsigned long int) peasycap); SAM("allocated 0x%08lX=peasycap\n", (unsigned long int) peasycap);
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#if defined(EASYCAP_IS_VIDEODEV_CLIENT) #if defined(EASYCAP_IS_VIDEODEV_CLIENT)
SAM("where 0x%08lX=&peasycap->video_device\n", \ SAM("where 0x%08lX=&peasycap->video_device\n",
(unsigned long int) &peasycap->video_device); (unsigned long int) &peasycap->video_device);
#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) #if defined(EASYCAP_NEEDS_V4L2_DEVICE_H)
SAM("and 0x%08lX=&peasycap->v4l2_device\n", \ SAM("and 0x%08lX=&peasycap->v4l2_device\n",
(unsigned long int) &peasycap->v4l2_device); (unsigned long int) &peasycap->v4l2_device);
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
...@@ -3545,8 +3545,8 @@ if (0 == bInterfaceNumber) { ...@@ -3545,8 +3545,8 @@ if (0 == bInterfaceNumber) {
peasycap->minor = -1; peasycap->minor = -1;
strcpy(&peasycap->telltale[0], TELLTALE); strcpy(&peasycap->telltale[0], TELLTALE);
kref_init(&peasycap->kref); kref_init(&peasycap->kref);
JOM(8, "intf[%i]: after kref_init(..._video) " \ JOM(8, "intf[%i]: after kref_init(..._video) "
"%i=peasycap->kref.refcount.counter\n", \ "%i=peasycap->kref.refcount.counter\n",
bInterfaceNumber, peasycap->kref.refcount.counter); bInterfaceNumber, peasycap->kref.refcount.counter);
/* module params */ /* module params */
...@@ -3571,15 +3571,15 @@ if (0 == bInterfaceNumber) { ...@@ -3571,15 +3571,15 @@ if (0 == bInterfaceNumber) {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
for (ndong = 0; ndong < DONGLE_MANY; ndong++) { for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
if ((NULL == easycapdc60_dongle[ndong].peasycap) && \ if ((NULL == easycapdc60_dongle[ndong].peasycap) &&
(!mutex_is_locked(&easycapdc60_dongle\ (!mutex_is_locked(&easycapdc60_dongle
[ndong].mutex_video)) && \ [ndong].mutex_video)) &&
(!mutex_is_locked(&easycapdc60_dongle\ (!mutex_is_locked(&easycapdc60_dongle
[ndong].mutex_audio))) { [ndong].mutex_audio))) {
easycapdc60_dongle[ndong].peasycap = peasycap; easycapdc60_dongle[ndong].peasycap = peasycap;
peasycap->isdongle = ndong; peasycap->isdongle = ndong;
JOM(8, "intf[%i]: peasycap-->easycap" \ JOM(8, "intf[%i]: peasycap-->easycap"
"_dongle[%i].peasycap\n", \ "_dongle[%i].peasycap\n",
bInterfaceNumber, ndong); bInterfaceNumber, ndong);
break; break;
} }
...@@ -3660,11 +3660,11 @@ if (0 == bInterfaceNumber) { ...@@ -3660,11 +3660,11 @@ if (0 == bInterfaceNumber) {
m = 0; m = 0;
mask = 0; mask = 0;
while (0xFFFF != easycap_standard[i].mask) { while (0xFFFF != easycap_standard[i].mask) {
if (NTSC_M == easycap_standard[i].\ if (NTSC_M == easycap_standard[i].
v4l2_standard.index) { v4l2_standard.index) {
m++; m++;
for (k = 0; k < INPUT_MANY; k++) { for (k = 0; k < INPUT_MANY; k++) {
peasycap->inputset[k].\ peasycap->inputset[k].
standard_offset = i; standard_offset = i;
} }
mask = easycap_standard[i].mask; mask = easycap_standard[i].mask;
...@@ -3676,11 +3676,11 @@ if (0 == bInterfaceNumber) { ...@@ -3676,11 +3676,11 @@ if (0 == bInterfaceNumber) {
m = 0; m = 0;
mask = 0; mask = 0;
while (0xFFFF != easycap_standard[i].mask) { while (0xFFFF != easycap_standard[i].mask) {
if (PAL_BGHIN == easycap_standard[i].\ if (PAL_BGHIN == easycap_standard[i].
v4l2_standard.index) { v4l2_standard.index) {
m++; m++;
for (k = 0; k < INPUT_MANY; k++) { for (k = 0; k < INPUT_MANY; k++) {
peasycap->inputset[k].\ peasycap->inputset[k].
standard_offset = i; standard_offset = i;
} }
mask = easycap_standard[i].mask; mask = easycap_standard[i].mask;
...@@ -3690,7 +3690,7 @@ if (0 == bInterfaceNumber) { ...@@ -3690,7 +3690,7 @@ if (0 == bInterfaceNumber) {
} }
if (1 != m) { if (1 != m) {
SAM("MISTAKE: easycap.inputset[].standard_offset " \ SAM("MISTAKE: easycap.inputset[].standard_offset "
"unpopulated, %i=m\n", m); "unpopulated, %i=m\n", m);
return -ENOENT; return -ENOENT;
} }
...@@ -3699,17 +3699,17 @@ if (0 == bInterfaceNumber) { ...@@ -3699,17 +3699,17 @@ if (0 == bInterfaceNumber) {
i = 0; i = 0;
m = 0; m = 0;
while (0 != peasycap_format->v4l2_format.fmt.pix.width) { while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
if (((peasycap_format->mask & 0x0F) == (mask & 0x0F)) && \ if (((peasycap_format->mask & 0x0F) == (mask & 0x0F)) &&
(peasycap_format->\ (peasycap_format->
v4l2_format.fmt.pix.field == \ v4l2_format.fmt.pix.field ==
V4L2_FIELD_NONE) && \ V4L2_FIELD_NONE) &&
(peasycap_format->\ (peasycap_format->
v4l2_format.fmt.pix.pixelformat == \ v4l2_format.fmt.pix.pixelformat ==
V4L2_PIX_FMT_UYVY) && \ V4L2_PIX_FMT_UYVY) &&
(peasycap_format->\ (peasycap_format->
v4l2_format.fmt.pix.width == \ v4l2_format.fmt.pix.width ==
640) && \ 640) &&
(peasycap_format->\ (peasycap_format->
v4l2_format.fmt.pix.height == 480)) { v4l2_format.fmt.pix.height == 480)) {
m++; m++;
for (k = 0; k < INPUT_MANY; k++) for (k = 0; k < INPUT_MANY; k++)
...@@ -3748,7 +3748,7 @@ if (0 == bInterfaceNumber) { ...@@ -3748,7 +3748,7 @@ if (0 == bInterfaceNumber) {
i++; i++;
} }
if (4 != m) { if (4 != m) {
SAM("MISTAKE: easycap.inputset[].brightness,... " \ SAM("MISTAKE: easycap.inputset[].brightness,... "
"underpopulated\n"); "underpopulated\n");
return -ENOENT; return -ENOENT;
} }
...@@ -3766,21 +3766,21 @@ if (0 == bInterfaceNumber) { ...@@ -3766,21 +3766,21 @@ if (0 == bInterfaceNumber) {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
for (ndong = 0; ndong < DONGLE_MANY; ndong++) { for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
if (pusb_device == easycapdc60_dongle[ndong].peasycap->\ if (pusb_device == easycapdc60_dongle[ndong].peasycap->
pusb_device) { pusb_device) {
peasycap = easycapdc60_dongle[ndong].peasycap; peasycap = easycapdc60_dongle[ndong].peasycap;
JOT(8, "intf[%i]: easycapdc60_dongle[%i].peasycap-->" \ JOT(8, "intf[%i]: easycapdc60_dongle[%i].peasycap-->"
"peasycap\n", bInterfaceNumber, ndong); "peasycap\n", bInterfaceNumber, ndong);
break; break;
} }
} }
if (DONGLE_MANY <= ndong) { if (DONGLE_MANY <= ndong) {
SAY("ERROR: peasycap is unknown when probing interface %i\n", \ SAY("ERROR: peasycap is unknown when probing interface %i\n",
bInterfaceNumber); bInterfaceNumber);
return -ENODEV; return -ENODEV;
} }
if (NULL == peasycap) { if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL when probing interface %i\n", \ SAY("ERROR: peasycap is NULL when probing interface %i\n",
bInterfaceNumber); bInterfaceNumber);
return -ENODEV; return -ENODEV;
} }
...@@ -3803,40 +3803,40 @@ if (0 == bInterfaceNumber) { ...@@ -3803,40 +3803,40 @@ if (0 == bInterfaceNumber) {
SAY("ERROR: pv4l2_device is NULL\n"); SAY("ERROR: pv4l2_device is NULL\n");
return -ENODEV; return -ENODEV;
} }
peasycap = (struct easycap *) \ peasycap = (struct easycap *)
container_of(pv4l2_device, struct easycap, v4l2_device); container_of(pv4l2_device, struct easycap, v4l2_device);
} }
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
if ((USB_CLASS_VIDEO == bInterfaceClass) || \ if ((USB_CLASS_VIDEO == bInterfaceClass) ||
(USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) {
if (-1 == peasycap->video_interface) { if (-1 == peasycap->video_interface) {
peasycap->video_interface = bInterfaceNumber; peasycap->video_interface = bInterfaceNumber;
JOM(4, "setting peasycap->video_interface=%i\n", \ JOM(4, "setting peasycap->video_interface=%i\n",
peasycap->video_interface); peasycap->video_interface);
} else { } else {
if (peasycap->video_interface != bInterfaceNumber) { if (peasycap->video_interface != bInterfaceNumber) {
SAM("ERROR: attempting to reset " \ SAM("ERROR: attempting to reset "
"peasycap->video_interface\n"); "peasycap->video_interface\n");
SAM("...... continuing with " \ SAM("...... continuing with "
"%i=peasycap->video_interface\n", \ "%i=peasycap->video_interface\n",
peasycap->video_interface); peasycap->video_interface);
} }
} }
} else if ((USB_CLASS_AUDIO == bInterfaceClass) && \ } else if ((USB_CLASS_AUDIO == bInterfaceClass) &&
(0x02 == bInterfaceSubClass)) { (0x02 == bInterfaceSubClass)) {
if (-1 == peasycap->audio_interface) { if (-1 == peasycap->audio_interface) {
peasycap->audio_interface = bInterfaceNumber; peasycap->audio_interface = bInterfaceNumber;
JOM(4, "setting peasycap->audio_interface=%i\n", \ JOM(4, "setting peasycap->audio_interface=%i\n",
peasycap->audio_interface); peasycap->audio_interface);
} else { } else {
if (peasycap->audio_interface != bInterfaceNumber) { if (peasycap->audio_interface != bInterfaceNumber) {
SAM("ERROR: attempting to reset " \ SAM("ERROR: attempting to reset "
"peasycap->audio_interface\n"); "peasycap->audio_interface\n");
SAM("...... continuing with " \ SAM("...... continuing with "
"%i=peasycap->audio_interface\n", \ "%i=peasycap->audio_interface\n",
peasycap->audio_interface); peasycap->audio_interface);
} }
} }
...@@ -3856,27 +3856,27 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) { ...@@ -3856,27 +3856,27 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) {
return -EFAULT; return -EFAULT;
} }
pusb_interface_descriptor = &(pusb_host_interface->desc); pusb_interface_descriptor = &(pusb_host_interface->desc);
if ((struct usb_interface_descriptor *)NULL == \ if ((struct usb_interface_descriptor *)NULL ==
pusb_interface_descriptor) { pusb_interface_descriptor) {
SAM("ERROR: pusb_interface_descriptor is NULL\n"); SAM("ERROR: pusb_interface_descriptor is NULL\n");
return -EFAULT; return -EFAULT;
} }
JOM(4, "intf[%i]alt[%i]: desc.bDescriptorType=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.bDescriptorType=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bDescriptorType); bInterfaceNumber, i, pusb_interface_descriptor->bDescriptorType);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceNumber=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceNumber=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceNumber); bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceNumber);
JOM(4, "intf[%i]alt[%i]: desc.bAlternateSetting=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.bAlternateSetting=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bAlternateSetting); bInterfaceNumber, i, pusb_interface_descriptor->bAlternateSetting);
JOM(4, "intf[%i]alt[%i]: desc.bNumEndpoints=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.bNumEndpoints=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bNumEndpoints); bInterfaceNumber, i, pusb_interface_descriptor->bNumEndpoints);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceClass=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceClass=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceClass); bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceClass);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceSubClass=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceSubClass=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceSubClass); bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceSubClass);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceProtocol=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.bInterfaceProtocol=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceProtocol); bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceProtocol);
JOM(4, "intf[%i]alt[%i]: desc.iInterface=0x%02X\n", \ JOM(4, "intf[%i]alt[%i]: desc.iInterface=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->iInterface); bInterfaceNumber, i, pusb_interface_descriptor->iInterface);
ISOCwMaxPacketSize = -1; ISOCwMaxPacketSize = -1;
...@@ -3887,7 +3887,7 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) { ...@@ -3887,7 +3887,7 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) {
INTbEndpointAddress = 0; INTbEndpointAddress = 0;
if (0 == pusb_interface_descriptor->bNumEndpoints) if (0 == pusb_interface_descriptor->bNumEndpoints)
JOM(4, "intf[%i]alt[%i] has no endpoints\n", \ JOM(4, "intf[%i]alt[%i] has no endpoints\n",
bInterfaceNumber, i); bInterfaceNumber, i);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
for (j = 0; j < pusb_interface_descriptor->bNumEndpoints; j++) { for (j = 0; j < pusb_interface_descriptor->bNumEndpoints; j++) {
...@@ -3900,88 +3900,88 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) { ...@@ -3900,88 +3900,88 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) {
wMaxPacketSize = le16_to_cpu(pepd->wMaxPacketSize); wMaxPacketSize = le16_to_cpu(pepd->wMaxPacketSize);
bEndpointAddress = pepd->bEndpointAddress; bEndpointAddress = pepd->bEndpointAddress;
JOM(4, "intf[%i]alt[%i]end[%i]: bEndpointAddress=0x%X\n", \ JOM(4, "intf[%i]alt[%i]end[%i]: bEndpointAddress=0x%X\n",
bInterfaceNumber, i, j, \ bInterfaceNumber, i, j,
pepd->bEndpointAddress); pepd->bEndpointAddress);
JOM(4, "intf[%i]alt[%i]end[%i]: bmAttributes=0x%X\n", \ JOM(4, "intf[%i]alt[%i]end[%i]: bmAttributes=0x%X\n",
bInterfaceNumber, i, j, \ bInterfaceNumber, i, j,
pepd->bmAttributes); pepd->bmAttributes);
JOM(4, "intf[%i]alt[%i]end[%i]: wMaxPacketSize=%i\n", \ JOM(4, "intf[%i]alt[%i]end[%i]: wMaxPacketSize=%i\n",
bInterfaceNumber, i, j, \ bInterfaceNumber, i, j,
pepd->wMaxPacketSize); pepd->wMaxPacketSize);
JOM(4, "intf[%i]alt[%i]end[%i]: bInterval=%i\n", JOM(4, "intf[%i]alt[%i]end[%i]: bInterval=%i\n",
bInterfaceNumber, i, j, \ bInterfaceNumber, i, j,
pepd->bInterval); pepd->bInterval);
if (pepd->bEndpointAddress & USB_DIR_IN) { if (pepd->bEndpointAddress & USB_DIR_IN) {
JOM(4, "intf[%i]alt[%i]end[%i] is an IN endpoint\n",\ JOM(4, "intf[%i]alt[%i]end[%i] is an IN endpoint\n",
bInterfaceNumber, i, j); bInterfaceNumber, i, j);
isin = 1; isin = 1;
} else { } else {
JOM(4, "intf[%i]alt[%i]end[%i] is an OUT endpoint\n",\ JOM(4, "intf[%i]alt[%i]end[%i] is an OUT endpoint\n",
bInterfaceNumber, i, j); bInterfaceNumber, i, j);
SAM("ERROR: OUT endpoint unexpected\n"); SAM("ERROR: OUT endpoint unexpected\n");
SAM("...... continuing\n"); SAM("...... continuing\n");
isin = 0; isin = 0;
} }
if ((pepd->bmAttributes & \ if ((pepd->bmAttributes &
USB_ENDPOINT_XFERTYPE_MASK) == \ USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_ISOC) { USB_ENDPOINT_XFER_ISOC) {
JOM(4, "intf[%i]alt[%i]end[%i] is an ISOC endpoint\n",\ JOM(4, "intf[%i]alt[%i]end[%i] is an ISOC endpoint\n",
bInterfaceNumber, i, j); bInterfaceNumber, i, j);
if (isin) { if (isin) {
switch (bInterfaceClass) { switch (bInterfaceClass) {
case USB_CLASS_VIDEO: case USB_CLASS_VIDEO:
case USB_CLASS_VENDOR_SPEC: { case USB_CLASS_VENDOR_SPEC: {
if (!peasycap) { if (!peasycap) {
SAM("MISTAKE: " \ SAM("MISTAKE: "
"peasycap is NULL\n"); "peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if (pepd->wMaxPacketSize) { if (pepd->wMaxPacketSize) {
if (8 > isokalt) { if (8 > isokalt) {
okalt[isokalt] = i; okalt[isokalt] = i;
JOM(4,\ JOM(4,
"%i=okalt[%i]\n", \ "%i=okalt[%i]\n",
okalt[isokalt], \ okalt[isokalt],
isokalt); isokalt);
okepn[isokalt] = \ okepn[isokalt] =
pepd->\ pepd->
bEndpointAddress & \ bEndpointAddress &
0x0F; 0x0F;
JOM(4,\ JOM(4,
"%i=okepn[%i]\n", \ "%i=okepn[%i]\n",
okepn[isokalt], \ okepn[isokalt],
isokalt); isokalt);
okmps[isokalt] = \ okmps[isokalt] =
le16_to_cpu(pepd->\ le16_to_cpu(pepd->
wMaxPacketSize); wMaxPacketSize);
JOM(4,\ JOM(4,
"%i=okmps[%i]\n", \ "%i=okmps[%i]\n",
okmps[isokalt], \ okmps[isokalt],
isokalt); isokalt);
isokalt++; isokalt++;
} }
} else { } else {
if (-1 == peasycap->\ if (-1 == peasycap->
video_altsetting_off) { video_altsetting_off) {
peasycap->\ peasycap->
video_altsetting_off =\ video_altsetting_off =
i; i;
JOM(4, "%i=video_" \ JOM(4, "%i=video_"
"altsetting_off " \ "altsetting_off "
"<====\n", \ "<====\n",
peasycap->\ peasycap->
video_altsetting_off); video_altsetting_off);
} else { } else {
SAM("ERROR: peasycap" \ SAM("ERROR: peasycap"
"->video_altsetting_" \ "->video_altsetting_"
"off already set\n"); "off already set\n");
SAM("...... " \ SAM("...... "
"continuing with " \ "continuing with "
"%i=peasycap->video_" \ "%i=peasycap->video_"
"altsetting_off\n", \ "altsetting_off\n",
peasycap->\ peasycap->
video_altsetting_off); video_altsetting_off);
} }
} }
...@@ -3991,55 +3991,55 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) { ...@@ -3991,55 +3991,55 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) {
if (0x02 != bInterfaceSubClass) if (0x02 != bInterfaceSubClass)
break; break;
if (!peasycap) { if (!peasycap) {
SAM("MISTAKE: " \ SAM("MISTAKE: "
"peasycap is NULL\n"); "peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if (pepd->wMaxPacketSize) { if (pepd->wMaxPacketSize) {
if (8 > isokalt) { if (8 > isokalt) {
okalt[isokalt] = i ; okalt[isokalt] = i ;
JOM(4,\ JOM(4,
"%i=okalt[%i]\n", \ "%i=okalt[%i]\n",
okalt[isokalt], \ okalt[isokalt],
isokalt); isokalt);
okepn[isokalt] = \ okepn[isokalt] =
pepd->\ pepd->
bEndpointAddress & \ bEndpointAddress &
0x0F; 0x0F;
JOM(4,\ JOM(4,
"%i=okepn[%i]\n", \ "%i=okepn[%i]\n",
okepn[isokalt], \ okepn[isokalt],
isokalt); isokalt);
okmps[isokalt] = \ okmps[isokalt] =
le16_to_cpu(pepd->\ le16_to_cpu(pepd->
wMaxPacketSize); wMaxPacketSize);
JOM(4,\ JOM(4,
"%i=okmps[%i]\n",\ "%i=okmps[%i]\n",
okmps[isokalt], \ okmps[isokalt],
isokalt); isokalt);
isokalt++; isokalt++;
} }
} else { } else {
if (-1 == peasycap->\ if (-1 == peasycap->
audio_altsetting_off) { audio_altsetting_off) {
peasycap->\ peasycap->
audio_altsetting_off =\ audio_altsetting_off =
i; i;
JOM(4, "%i=audio_" \ JOM(4, "%i=audio_"
"altsetting_off " \ "altsetting_off "
"<====\n", \ "<====\n",
peasycap->\ peasycap->
audio_altsetting_off); audio_altsetting_off);
} else { } else {
SAM("ERROR: peasycap" \ SAM("ERROR: peasycap"
"->audio_altsetting_" \ "->audio_altsetting_"
"off already set\n"); "off already set\n");
SAM("...... " \ SAM("...... "
"continuing with " \ "continuing with "
"%i=peasycap->\ "%i=peasycap->"
audio_altsetting_" \ "audio_altsetting_"
"off\n", "off\n",
peasycap->\ peasycap->
audio_altsetting_off); audio_altsetting_off);
} }
} }
...@@ -4049,23 +4049,23 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) { ...@@ -4049,23 +4049,23 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) {
break; break;
} }
} }
} else if ((pepd->bmAttributes & \ } else if ((pepd->bmAttributes &
USB_ENDPOINT_XFERTYPE_MASK) ==\ USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK) { USB_ENDPOINT_XFER_BULK) {
JOM(4, "intf[%i]alt[%i]end[%i] is a BULK endpoint\n",\ JOM(4, "intf[%i]alt[%i]end[%i] is a BULK endpoint\n",
bInterfaceNumber, i, j); bInterfaceNumber, i, j);
} else if ((pepd->bmAttributes & \ } else if ((pepd->bmAttributes &
USB_ENDPOINT_XFERTYPE_MASK) ==\ USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_INT) { USB_ENDPOINT_XFER_INT) {
JOM(4, "intf[%i]alt[%i]end[%i] is an INT endpoint\n",\ JOM(4, "intf[%i]alt[%i]end[%i] is an INT endpoint\n",
bInterfaceNumber, i, j); bInterfaceNumber, i, j);
} else { } else {
JOM(4, "intf[%i]alt[%i]end[%i] is a CTRL endpoint\n",\ JOM(4, "intf[%i]alt[%i]end[%i] is a CTRL endpoint\n",
bInterfaceNumber, i, j); bInterfaceNumber, i, j);
} }
if (0 == pepd->wMaxPacketSize) { if (0 == pepd->wMaxPacketSize) {
JOM(4, "intf[%i]alt[%i]end[%i] " \ JOM(4, "intf[%i]alt[%i]end[%i] "
"has zero packet size\n", \ "has zero packet size\n",
bInterfaceNumber, i, j); bInterfaceNumber, i, j);
} }
} }
...@@ -4075,7 +4075,7 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) { ...@@ -4075,7 +4075,7 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) {
* PERFORM INITIALIZATION OF THE PROBED INTERFACE * PERFORM INITIALIZATION OF THE PROBED INTERFACE
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "initialization begins for interface %i\n", \ JOM(4, "initialization begins for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber); pusb_interface_descriptor->bInterfaceNumber);
switch (bInterfaceNumber) { switch (bInterfaceNumber) {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -4093,7 +4093,7 @@ case 0: { ...@@ -4093,7 +4093,7 @@ case 0: {
return -ENOENT; return -ENOENT;
} else { } else {
peasycap->video_altsetting_on = okalt[isokalt - 1]; peasycap->video_altsetting_on = okalt[isokalt - 1];
JOM(4, "%i=video_altsetting_on <====\n", \ JOM(4, "%i=video_altsetting_on <====\n",
peasycap->video_altsetting_on); peasycap->video_altsetting_on);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -4107,10 +4107,10 @@ case 0: { ...@@ -4107,10 +4107,10 @@ case 0: {
if (USB_2_0_MAXPACKETSIZE > maxpacketsize) { if (USB_2_0_MAXPACKETSIZE > maxpacketsize) {
peasycap->video_isoc_maxframesize = maxpacketsize; peasycap->video_isoc_maxframesize = maxpacketsize;
} else { } else {
peasycap->video_isoc_maxframesize = \ peasycap->video_isoc_maxframesize =
USB_2_0_MAXPACKETSIZE; USB_2_0_MAXPACKETSIZE;
} }
JOM(4, "%i=video_isoc_maxframesize\n", \ JOM(4, "%i=video_isoc_maxframesize\n",
peasycap->video_isoc_maxframesize); peasycap->video_isoc_maxframesize);
if (0 >= peasycap->video_isoc_maxframesize) { if (0 >= peasycap->video_isoc_maxframesize) {
SAM("ERROR: bad video_isoc_maxframesize\n"); SAM("ERROR: bad video_isoc_maxframesize\n");
...@@ -4118,18 +4118,18 @@ case 0: { ...@@ -4118,18 +4118,18 @@ case 0: {
return -ENOENT; return -ENOENT;
} }
peasycap->video_isoc_framesperdesc = VIDEO_ISOC_FRAMESPERDESC; peasycap->video_isoc_framesperdesc = VIDEO_ISOC_FRAMESPERDESC;
JOM(4, "%i=video_isoc_framesperdesc\n", \ JOM(4, "%i=video_isoc_framesperdesc\n",
peasycap->video_isoc_framesperdesc); peasycap->video_isoc_framesperdesc);
if (0 >= peasycap->video_isoc_framesperdesc) { if (0 >= peasycap->video_isoc_framesperdesc) {
SAM("ERROR: bad video_isoc_framesperdesc\n"); SAM("ERROR: bad video_isoc_framesperdesc\n");
return -ENOENT; return -ENOENT;
} }
peasycap->video_isoc_buffer_size = \ peasycap->video_isoc_buffer_size =
peasycap->video_isoc_maxframesize * \ peasycap->video_isoc_maxframesize *
peasycap->video_isoc_framesperdesc; peasycap->video_isoc_framesperdesc;
JOM(4, "%i=video_isoc_buffer_size\n", \ JOM(4, "%i=video_isoc_buffer_size\n",
peasycap->video_isoc_buffer_size); peasycap->video_isoc_buffer_size);
if ((PAGE_SIZE << VIDEO_ISOC_ORDER) < \ if ((PAGE_SIZE << VIDEO_ISOC_ORDER) <
peasycap->video_isoc_buffer_size) { peasycap->video_isoc_buffer_size) {
SAM("MISTAKE: peasycap->video_isoc_buffer_size too big\n"); SAM("MISTAKE: peasycap->video_isoc_buffer_size too big\n");
return -EFAULT; return -EFAULT;
...@@ -4167,50 +4167,50 @@ case 0: { ...@@ -4167,50 +4167,50 @@ case 0: {
INIT_LIST_HEAD(&(peasycap->urb_video_head)); INIT_LIST_HEAD(&(peasycap->urb_video_head));
peasycap->purb_video_head = &(peasycap->urb_video_head); peasycap->purb_video_head = &(peasycap->urb_video_head);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i frame buffers of size %li\n", \ JOM(4, "allocating %i frame buffers of size %li\n",
FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE); FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE);
JOM(4, ".... each scattered over %li pages\n", \ JOM(4, ".... each scattered over %li pages\n",
FRAME_BUFFER_SIZE/PAGE_SIZE); FRAME_BUFFER_SIZE/PAGE_SIZE);
for (k = 0; k < FRAME_BUFFER_MANY; k++) { for (k = 0; k < FRAME_BUFFER_MANY; k++) {
for (m = 0; m < FRAME_BUFFER_SIZE/PAGE_SIZE; m++) { for (m = 0; m < FRAME_BUFFER_SIZE/PAGE_SIZE; m++) {
if ((void *)NULL != peasycap->frame_buffer[k][m].pgo) if ((void *)NULL != peasycap->frame_buffer[k][m].pgo)
SAM("attempting to reallocate frame " \ SAM("attempting to reallocate frame "
" buffers\n"); " buffers\n");
else { else {
pbuf = (void *)__get_free_page(GFP_KERNEL); pbuf = (void *)__get_free_page(GFP_KERNEL);
if ((void *)NULL == pbuf) { if ((void *)NULL == pbuf) {
SAM("ERROR: Could not allocate frame "\ SAM("ERROR: Could not allocate frame "
"buffer %i page %i\n", k, m); "buffer %i page %i\n", k, m);
return -ENOMEM; return -ENOMEM;
} else } else
peasycap->allocation_video_page += 1; peasycap->allocation_video_page += 1;
peasycap->frame_buffer[k][m].pgo = pbuf; peasycap->frame_buffer[k][m].pgo = pbuf;
} }
peasycap->frame_buffer[k][m].pto = \ peasycap->frame_buffer[k][m].pto =
peasycap->frame_buffer[k][m].pgo; peasycap->frame_buffer[k][m].pgo;
} }
} }
peasycap->frame_fill = 0; peasycap->frame_fill = 0;
peasycap->frame_read = 0; peasycap->frame_read = 0;
JOM(4, "allocation of frame buffers done: %i pages\n", k * \ JOM(4, "allocation of frame buffers done: %i pages\n", k *
m); m);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i field buffers of size %li\n", \ JOM(4, "allocating %i field buffers of size %li\n",
FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE); FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE);
JOM(4, ".... each scattered over %li pages\n", \ JOM(4, ".... each scattered over %li pages\n",
FIELD_BUFFER_SIZE/PAGE_SIZE); FIELD_BUFFER_SIZE/PAGE_SIZE);
for (k = 0; k < FIELD_BUFFER_MANY; k++) { for (k = 0; k < FIELD_BUFFER_MANY; k++) {
for (m = 0; m < FIELD_BUFFER_SIZE/PAGE_SIZE; m++) { for (m = 0; m < FIELD_BUFFER_SIZE/PAGE_SIZE; m++) {
if ((void *)NULL != peasycap->field_buffer[k][m].pgo) { if ((void *)NULL != peasycap->field_buffer[k][m].pgo) {
SAM("ERROR: attempting to reallocate " \ SAM("ERROR: attempting to reallocate "
"field buffers\n"); "field buffers\n");
} else { } else {
pbuf = (void *) __get_free_page(GFP_KERNEL); pbuf = (void *) __get_free_page(GFP_KERNEL);
if ((void *)NULL == pbuf) { if ((void *)NULL == pbuf) {
SAM("ERROR: Could not allocate field" \ SAM("ERROR: Could not allocate field"
" buffer %i page %i\n", k, m); " buffer %i page %i\n", k, m);
return -ENOMEM; return -ENOMEM;
} }
...@@ -4218,7 +4218,7 @@ case 0: { ...@@ -4218,7 +4218,7 @@ case 0: {
peasycap->allocation_video_page += 1; peasycap->allocation_video_page += 1;
peasycap->field_buffer[k][m].pgo = pbuf; peasycap->field_buffer[k][m].pgo = pbuf;
} }
peasycap->field_buffer[k][m].pto = \ peasycap->field_buffer[k][m].pto =
peasycap->field_buffer[k][m].pgo; peasycap->field_buffer[k][m].pgo;
} }
peasycap->field_buffer[k][0].kount = 0x0200; peasycap->field_buffer[k][0].kount = 0x0200;
...@@ -4226,30 +4226,30 @@ case 0: { ...@@ -4226,30 +4226,30 @@ case 0: {
peasycap->field_fill = 0; peasycap->field_fill = 0;
peasycap->field_page = 0; peasycap->field_page = 0;
peasycap->field_read = 0; peasycap->field_read = 0;
JOM(4, "allocation of field buffers done: %i pages\n", k * \ JOM(4, "allocation of field buffers done: %i pages\n", k *
m); m);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i isoc video buffers of size %i\n", \ JOM(4, "allocating %i isoc video buffers of size %i\n",
VIDEO_ISOC_BUFFER_MANY, \ VIDEO_ISOC_BUFFER_MANY,
peasycap->video_isoc_buffer_size); peasycap->video_isoc_buffer_size);
JOM(4, ".... each occupying contiguous memory pages\n"); JOM(4, ".... each occupying contiguous memory pages\n");
for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) {
pbuf = (void *)__get_free_pages(GFP_KERNEL, VIDEO_ISOC_ORDER); pbuf = (void *)__get_free_pages(GFP_KERNEL, VIDEO_ISOC_ORDER);
if (NULL == pbuf) { if (NULL == pbuf) {
SAM("ERROR: Could not allocate isoc video buffer " \ SAM("ERROR: Could not allocate isoc video buffer "
"%i\n", k); "%i\n", k);
return -ENOMEM; return -ENOMEM;
} else } else
peasycap->allocation_video_page += \ peasycap->allocation_video_page +=
((unsigned int)(0x01 << VIDEO_ISOC_ORDER)); ((unsigned int)(0x01 << VIDEO_ISOC_ORDER));
peasycap->video_isoc_buffer[k].pgo = pbuf; peasycap->video_isoc_buffer[k].pgo = pbuf;
peasycap->video_isoc_buffer[k].pto = pbuf + \ peasycap->video_isoc_buffer[k].pto = pbuf +
peasycap->video_isoc_buffer_size; peasycap->video_isoc_buffer_size;
peasycap->video_isoc_buffer[k].kount = k; peasycap->video_isoc_buffer[k].kount = k;
} }
JOM(4, "allocation of isoc video buffers done: %i pages\n", \ JOM(4, "allocation of isoc video buffers done: %i pages\n",
k * (0x01 << VIDEO_ISOC_ORDER)); k * (0x01 << VIDEO_ISOC_ORDER));
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
...@@ -4257,18 +4257,18 @@ case 0: { ...@@ -4257,18 +4257,18 @@ case 0: {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY); JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY);
JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n", \ JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n",
peasycap->video_isoc_framesperdesc); peasycap->video_isoc_framesperdesc);
JOM(4, "using %i=peasycap->video_isoc_maxframesize\n", \ JOM(4, "using %i=peasycap->video_isoc_maxframesize\n",
peasycap->video_isoc_maxframesize); peasycap->video_isoc_maxframesize);
JOM(4, "using %i=peasycap->video_isoc_buffer_sizen", \ JOM(4, "using %i=peasycap->video_isoc_buffer_sizen",
peasycap->video_isoc_buffer_size); peasycap->video_isoc_buffer_size);
for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) {
purb = usb_alloc_urb(peasycap->video_isoc_framesperdesc, \ purb = usb_alloc_urb(peasycap->video_isoc_framesperdesc,
GFP_KERNEL); GFP_KERNEL);
if (NULL == purb) { if (NULL == purb) {
SAM("ERROR: usb_alloc_urb returned NULL for buffer " \ SAM("ERROR: usb_alloc_urb returned NULL for buffer "
"%i\n", k); "%i\n", k);
return -ENOMEM; return -ENOMEM;
} else } else
...@@ -4279,13 +4279,13 @@ case 0: { ...@@ -4279,13 +4279,13 @@ case 0: {
SAM("ERROR: Could not allocate struct data_urb.\n"); SAM("ERROR: Could not allocate struct data_urb.\n");
return -ENOMEM; return -ENOMEM;
} else } else
peasycap->allocation_video_struct += \ peasycap->allocation_video_struct +=
sizeof(struct data_urb); sizeof(struct data_urb);
pdata_urb->purb = purb; pdata_urb->purb = purb;
pdata_urb->isbuf = k; pdata_urb->isbuf = k;
pdata_urb->length = 0; pdata_urb->length = 0;
list_add_tail(&(pdata_urb->list_head), \ list_add_tail(&(pdata_urb->list_head),
peasycap->purb_video_head); peasycap->purb_video_head);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
...@@ -4296,45 +4296,45 @@ case 0: { ...@@ -4296,45 +4296,45 @@ case 0: {
JOM(4, "initializing video urbs thus:\n"); JOM(4, "initializing video urbs thus:\n");
JOM(4, " purb->interval = 1;\n"); JOM(4, " purb->interval = 1;\n");
JOM(4, " purb->dev = peasycap->pusb_device;\n"); JOM(4, " purb->dev = peasycap->pusb_device;\n");
JOM(4, " purb->pipe = usb_rcvisocpipe" \ JOM(4, " purb->pipe = usb_rcvisocpipe"
"(peasycap->pusb_device,%i);\n", \ "(peasycap->pusb_device,%i);\n",
peasycap->video_endpointnumber); peasycap->video_endpointnumber);
JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n"); JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n");
JOM(4, " purb->transfer_buffer = peasycap->" \ JOM(4, " purb->transfer_buffer = peasycap->"
"video_isoc_buffer[.].pgo;\n"); "video_isoc_buffer[.].pgo;\n");
JOM(4, " purb->transfer_buffer_length = %i;\n", \ JOM(4, " purb->transfer_buffer_length = %i;\n",
peasycap->video_isoc_buffer_size); peasycap->video_isoc_buffer_size);
JOM(4, " purb->complete = easycap_complete;\n"); JOM(4, " purb->complete = easycap_complete;\n");
JOM(4, " purb->context = peasycap;\n"); JOM(4, " purb->context = peasycap;\n");
JOM(4, " purb->start_frame = 0;\n"); JOM(4, " purb->start_frame = 0;\n");
JOM(4, " purb->number_of_packets = %i;\n", \ JOM(4, " purb->number_of_packets = %i;\n",
peasycap->video_isoc_framesperdesc); peasycap->video_isoc_framesperdesc);
JOM(4, " for (j = 0; j < %i; j++)\n", \ JOM(4, " for (j = 0; j < %i; j++)\n",
peasycap->video_isoc_framesperdesc); peasycap->video_isoc_framesperdesc);
JOM(4, " {\n"); JOM(4, " {\n");
JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n",\ JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n",
peasycap->video_isoc_maxframesize); peasycap->video_isoc_maxframesize);
JOM(4, " purb->iso_frame_desc[j].length = %i;\n", \ JOM(4, " purb->iso_frame_desc[j].length = %i;\n",
peasycap->video_isoc_maxframesize); peasycap->video_isoc_maxframesize);
JOM(4, " }\n"); JOM(4, " }\n");
} }
purb->interval = 1; purb->interval = 1;
purb->dev = peasycap->pusb_device; purb->dev = peasycap->pusb_device;
purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, \ purb->pipe = usb_rcvisocpipe(peasycap->pusb_device,
peasycap->video_endpointnumber); peasycap->video_endpointnumber);
purb->transfer_flags = URB_ISO_ASAP; purb->transfer_flags = URB_ISO_ASAP;
purb->transfer_buffer = peasycap->video_isoc_buffer[k].pgo; purb->transfer_buffer = peasycap->video_isoc_buffer[k].pgo;
purb->transfer_buffer_length = \ purb->transfer_buffer_length =
peasycap->video_isoc_buffer_size; peasycap->video_isoc_buffer_size;
purb->complete = easycap_complete; purb->complete = easycap_complete;
purb->context = peasycap; purb->context = peasycap;
purb->start_frame = 0; purb->start_frame = 0;
purb->number_of_packets = peasycap->video_isoc_framesperdesc; purb->number_of_packets = peasycap->video_isoc_framesperdesc;
for (j = 0; j < peasycap->video_isoc_framesperdesc; j++) { for (j = 0; j < peasycap->video_isoc_framesperdesc; j++) {
purb->iso_frame_desc[j].offset = j * \ purb->iso_frame_desc[j].offset = j *
peasycap->video_isoc_maxframesize; peasycap->video_isoc_maxframesize;
purb->iso_frame_desc[j].length = \ purb->iso_frame_desc[j].length =
peasycap->video_isoc_maxframesize; peasycap->video_isoc_maxframesize;
} }
} }
...@@ -4384,12 +4384,12 @@ case 0: { ...@@ -4384,12 +4384,12 @@ case 0: {
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#else #else
#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) #if defined(EASYCAP_NEEDS_V4L2_DEVICE_H)
if (0 != (v4l2_device_register(&(pusb_interface->dev), \ if (0 != (v4l2_device_register(&(pusb_interface->dev),
&(peasycap->v4l2_device)))) { &(peasycap->v4l2_device)))) {
SAM("v4l2_device_register() failed\n"); SAM("v4l2_device_register() failed\n");
return -ENODEV; return -ENODEV;
} else { } else {
JOM(4, "registered device instance: %s\n", \ JOM(4, "registered device instance: %s\n",
&(peasycap->v4l2_device.name[0])); &(peasycap->v4l2_device.name[0]));
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -4416,14 +4416,14 @@ case 0: { ...@@ -4416,14 +4416,14 @@ case 0: {
video_set_drvdata(&(peasycap->video_device), (void *)peasycap); video_set_drvdata(&(peasycap->video_device), (void *)peasycap);
if (0 != (video_register_device(&(peasycap->video_device), \ if (0 != (video_register_device(&(peasycap->video_device),
VFL_TYPE_GRABBER, -1))) { VFL_TYPE_GRABBER, -1))) {
err("Not able to register with videodev"); err("Not able to register with videodev");
videodev_release(&(peasycap->video_device)); videodev_release(&(peasycap->video_device));
return -ENODEV; return -ENODEV;
} else { } else {
(peasycap->registered_video)++; (peasycap->registered_video)++;
SAM("registered with videodev: %i=minor\n", \ SAM("registered with videodev: %i=minor\n",
peasycap->video_device.minor); peasycap->video_device.minor);
peasycap->minor = peasycap->video_device.minor; peasycap->minor = peasycap->video_device.minor;
} }
...@@ -4452,7 +4452,7 @@ case 1: { ...@@ -4452,7 +4452,7 @@ case 1: {
*/ */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
usb_set_intfdata(pusb_interface, peasycap); usb_set_intfdata(pusb_interface, peasycap);
JOM(4, "no initialization required for interface %i\n", \ JOM(4, "no initialization required for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber); pusb_interface_descriptor->bInterfaceNumber);
break; break;
} }
...@@ -4470,7 +4470,7 @@ case 2: { ...@@ -4470,7 +4470,7 @@ case 2: {
return -ENOENT; return -ENOENT;
} else { } else {
peasycap->audio_altsetting_on = okalt[isokalt - 1]; peasycap->audio_altsetting_on = okalt[isokalt - 1];
JOM(4, "%i=audio_altsetting_on <====\n", \ JOM(4, "%i=audio_altsetting_on <====\n",
peasycap->audio_altsetting_on); peasycap->audio_altsetting_on);
} }
...@@ -4478,7 +4478,7 @@ case 2: { ...@@ -4478,7 +4478,7 @@ case 2: {
JOM(4, "%i=audio_endpointnumber\n", peasycap->audio_endpointnumber); JOM(4, "%i=audio_endpointnumber\n", peasycap->audio_endpointnumber);
peasycap->audio_isoc_maxframesize = okmps[isokalt - 1]; peasycap->audio_isoc_maxframesize = okmps[isokalt - 1];
JOM(4, "%i=audio_isoc_maxframesize\n", \ JOM(4, "%i=audio_isoc_maxframesize\n",
peasycap->audio_isoc_maxframesize); peasycap->audio_isoc_maxframesize);
if (0 >= peasycap->audio_isoc_maxframesize) { if (0 >= peasycap->audio_isoc_maxframesize) {
SAM("ERROR: bad audio_isoc_maxframesize\n"); SAM("ERROR: bad audio_isoc_maxframesize\n");
...@@ -4496,42 +4496,42 @@ case 2: { ...@@ -4496,42 +4496,42 @@ case 2: {
peasycap->audio_pages_per_fragment = PAGES_PER_AUDIO_FRAGMENT; peasycap->audio_pages_per_fragment = PAGES_PER_AUDIO_FRAGMENT;
} else { } else {
SAM("hardware is unidentified:\n"); SAM("hardware is unidentified:\n");
SAM("%i=audio_isoc_maxframesize\n", \ SAM("%i=audio_isoc_maxframesize\n",
peasycap->audio_isoc_maxframesize); peasycap->audio_isoc_maxframesize);
return -ENOENT; return -ENOENT;
} }
peasycap->audio_bytes_per_fragment = \ peasycap->audio_bytes_per_fragment =
peasycap->audio_pages_per_fragment * \ peasycap->audio_pages_per_fragment *
PAGE_SIZE ; PAGE_SIZE ;
peasycap->audio_buffer_page_many = (AUDIO_FRAGMENT_MANY * \ peasycap->audio_buffer_page_many = (AUDIO_FRAGMENT_MANY *
peasycap->audio_pages_per_fragment); peasycap->audio_pages_per_fragment);
JOM(4, "%6i=AUDIO_FRAGMENT_MANY\n", AUDIO_FRAGMENT_MANY); JOM(4, "%6i=AUDIO_FRAGMENT_MANY\n", AUDIO_FRAGMENT_MANY);
JOM(4, "%6i=audio_pages_per_fragment\n", \ JOM(4, "%6i=audio_pages_per_fragment\n",
peasycap->audio_pages_per_fragment); peasycap->audio_pages_per_fragment);
JOM(4, "%6i=audio_bytes_per_fragment\n", \ JOM(4, "%6i=audio_bytes_per_fragment\n",
peasycap->audio_bytes_per_fragment); peasycap->audio_bytes_per_fragment);
JOM(4, "%6i=audio_buffer_page_many\n", \ JOM(4, "%6i=audio_buffer_page_many\n",
peasycap->audio_buffer_page_many); peasycap->audio_buffer_page_many);
peasycap->audio_isoc_framesperdesc = AUDIO_ISOC_FRAMESPERDESC; peasycap->audio_isoc_framesperdesc = AUDIO_ISOC_FRAMESPERDESC;
JOM(4, "%i=audio_isoc_framesperdesc\n", \ JOM(4, "%i=audio_isoc_framesperdesc\n",
peasycap->audio_isoc_framesperdesc); peasycap->audio_isoc_framesperdesc);
if (0 >= peasycap->audio_isoc_framesperdesc) { if (0 >= peasycap->audio_isoc_framesperdesc) {
SAM("ERROR: bad audio_isoc_framesperdesc\n"); SAM("ERROR: bad audio_isoc_framesperdesc\n");
return -ENOENT; return -ENOENT;
} }
peasycap->audio_isoc_buffer_size = \ peasycap->audio_isoc_buffer_size =
peasycap->audio_isoc_maxframesize * \ peasycap->audio_isoc_maxframesize *
peasycap->audio_isoc_framesperdesc; peasycap->audio_isoc_framesperdesc;
JOM(4, "%i=audio_isoc_buffer_size\n", \ JOM(4, "%i=audio_isoc_buffer_size\n",
peasycap->audio_isoc_buffer_size); peasycap->audio_isoc_buffer_size);
if (AUDIO_ISOC_BUFFER_SIZE < peasycap->audio_isoc_buffer_size) { if (AUDIO_ISOC_BUFFER_SIZE < peasycap->audio_isoc_buffer_size) {
SAM("MISTAKE: audio_isoc_buffer_size bigger " SAM("MISTAKE: audio_isoc_buffer_size bigger "
"than %li=AUDIO_ISOC_BUFFER_SIZE\n", \ "than %li=AUDIO_ISOC_BUFFER_SIZE\n",
AUDIO_ISOC_BUFFER_SIZE); AUDIO_ISOC_BUFFER_SIZE);
return -EFAULT; return -EFAULT;
} }
...@@ -4569,7 +4569,7 @@ case 2: { ...@@ -4569,7 +4569,7 @@ case 2: {
#if !defined(EASYCAP_NEEDS_ALSA) #if !defined(EASYCAP_NEEDS_ALSA)
JOM(4, "allocating an audio buffer\n"); JOM(4, "allocating an audio buffer\n");
JOM(4, ".... scattered over %i pages\n", \ JOM(4, ".... scattered over %i pages\n",
peasycap->audio_buffer_page_many); peasycap->audio_buffer_page_many);
for (k = 0; k < peasycap->audio_buffer_page_many; k++) { for (k = 0; k < peasycap->audio_buffer_page_many; k++) {
...@@ -4578,7 +4578,7 @@ case 2: { ...@@ -4578,7 +4578,7 @@ case 2: {
} else { } else {
pbuf = (void *) __get_free_page(GFP_KERNEL); pbuf = (void *) __get_free_page(GFP_KERNEL);
if ((void *)NULL == pbuf) { if ((void *)NULL == pbuf) {
SAM("ERROR: Could not allocate audio " \ SAM("ERROR: Could not allocate audio "
"buffer page %i\n", k); "buffer page %i\n", k);
return -ENOMEM; return -ENOMEM;
} else } else
...@@ -4594,22 +4594,22 @@ case 2: { ...@@ -4594,22 +4594,22 @@ case 2: {
JOM(4, "allocation of audio buffer done: %i pages\n", k); JOM(4, "allocation of audio buffer done: %i pages\n", k);
#endif /*!EASYCAP_NEEDS_ALSA*/ #endif /*!EASYCAP_NEEDS_ALSA*/
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i isoc audio buffers of size %i\n", \ JOM(4, "allocating %i isoc audio buffers of size %i\n",
AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size); AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size);
JOM(4, ".... each occupying contiguous memory pages\n"); JOM(4, ".... each occupying contiguous memory pages\n");
for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) {
pbuf = (void *)__get_free_pages(GFP_KERNEL, AUDIO_ISOC_ORDER); pbuf = (void *)__get_free_pages(GFP_KERNEL, AUDIO_ISOC_ORDER);
if (NULL == pbuf) { if (NULL == pbuf) {
SAM("ERROR: Could not allocate isoc audio buffer " \ SAM("ERROR: Could not allocate isoc audio buffer "
"%i\n", k); "%i\n", k);
return -ENOMEM; return -ENOMEM;
} else } else
peasycap->allocation_audio_page += \ peasycap->allocation_audio_page +=
((unsigned int)(0x01 << AUDIO_ISOC_ORDER)); ((unsigned int)(0x01 << AUDIO_ISOC_ORDER));
peasycap->audio_isoc_buffer[k].pgo = pbuf; peasycap->audio_isoc_buffer[k].pgo = pbuf;
peasycap->audio_isoc_buffer[k].pto = pbuf + \ peasycap->audio_isoc_buffer[k].pto = pbuf +
peasycap->audio_isoc_buffer_size; peasycap->audio_isoc_buffer_size;
peasycap->audio_isoc_buffer[k].kount = k; peasycap->audio_isoc_buffer[k].kount = k;
} }
...@@ -4620,18 +4620,18 @@ case 2: { ...@@ -4620,18 +4620,18 @@ case 2: {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i struct urb.\n", AUDIO_ISOC_BUFFER_MANY); JOM(4, "allocating %i struct urb.\n", AUDIO_ISOC_BUFFER_MANY);
JOM(4, "using %i=peasycap->audio_isoc_framesperdesc\n", \ JOM(4, "using %i=peasycap->audio_isoc_framesperdesc\n",
peasycap->audio_isoc_framesperdesc); peasycap->audio_isoc_framesperdesc);
JOM(4, "using %i=peasycap->audio_isoc_maxframesize\n", \ JOM(4, "using %i=peasycap->audio_isoc_maxframesize\n",
peasycap->audio_isoc_maxframesize); peasycap->audio_isoc_maxframesize);
JOM(4, "using %i=peasycap->audio_isoc_buffer_size\n", \ JOM(4, "using %i=peasycap->audio_isoc_buffer_size\n",
peasycap->audio_isoc_buffer_size); peasycap->audio_isoc_buffer_size);
for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) {
purb = usb_alloc_urb(peasycap->audio_isoc_framesperdesc, \ purb = usb_alloc_urb(peasycap->audio_isoc_framesperdesc,
GFP_KERNEL); GFP_KERNEL);
if (NULL == purb) { if (NULL == purb) {
SAM("ERROR: usb_alloc_urb returned NULL for buffer " \ SAM("ERROR: usb_alloc_urb returned NULL for buffer "
"%i\n", k); "%i\n", k);
return -ENOMEM; return -ENOMEM;
} else } else
...@@ -4642,13 +4642,13 @@ case 2: { ...@@ -4642,13 +4642,13 @@ case 2: {
SAM("ERROR: Could not allocate struct data_urb.\n"); SAM("ERROR: Could not allocate struct data_urb.\n");
return -ENOMEM; return -ENOMEM;
} else } else
peasycap->allocation_audio_struct += \ peasycap->allocation_audio_struct +=
sizeof(struct data_urb); sizeof(struct data_urb);
pdata_urb->purb = purb; pdata_urb->purb = purb;
pdata_urb->isbuf = k; pdata_urb->isbuf = k;
pdata_urb->length = 0; pdata_urb->length = 0;
list_add_tail(&(pdata_urb->list_head), \ list_add_tail(&(pdata_urb->list_head),
peasycap->purb_audio_head); peasycap->purb_audio_head);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
...@@ -4659,13 +4659,13 @@ case 2: { ...@@ -4659,13 +4659,13 @@ case 2: {
JOM(4, "initializing audio urbs thus:\n"); JOM(4, "initializing audio urbs thus:\n");
JOM(4, " purb->interval = 1;\n"); JOM(4, " purb->interval = 1;\n");
JOM(4, " purb->dev = peasycap->pusb_device;\n"); JOM(4, " purb->dev = peasycap->pusb_device;\n");
JOM(4, " purb->pipe = usb_rcvisocpipe(peasycap->" \ JOM(4, " purb->pipe = usb_rcvisocpipe(peasycap->"
"pusb_device,%i);\n", \ "pusb_device,%i);\n",
peasycap->audio_endpointnumber); peasycap->audio_endpointnumber);
JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n"); JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n");
JOM(4, " purb->transfer_buffer = " \ JOM(4, " purb->transfer_buffer = "
"peasycap->audio_isoc_buffer[.].pgo;\n"); "peasycap->audio_isoc_buffer[.].pgo;\n");
JOM(4, " purb->transfer_buffer_length = %i;\n", \ JOM(4, " purb->transfer_buffer_length = %i;\n",
peasycap->audio_isoc_buffer_size); peasycap->audio_isoc_buffer_size);
#if defined(EASYCAP_NEEDS_ALSA) #if defined(EASYCAP_NEEDS_ALSA)
JOM(4, " purb->complete = easycap_alsa_complete;\n"); JOM(4, " purb->complete = easycap_alsa_complete;\n");
...@@ -4674,25 +4674,25 @@ case 2: { ...@@ -4674,25 +4674,25 @@ case 2: {
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /*EASYCAP_NEEDS_ALSA*/
JOM(4, " purb->context = peasycap;\n"); JOM(4, " purb->context = peasycap;\n");
JOM(4, " purb->start_frame = 0;\n"); JOM(4, " purb->start_frame = 0;\n");
JOM(4, " purb->number_of_packets = %i;\n", \ JOM(4, " purb->number_of_packets = %i;\n",
peasycap->audio_isoc_framesperdesc); peasycap->audio_isoc_framesperdesc);
JOM(4, " for (j = 0; j < %i; j++)\n", \ JOM(4, " for (j = 0; j < %i; j++)\n",
peasycap->audio_isoc_framesperdesc); peasycap->audio_isoc_framesperdesc);
JOM(4, " {\n"); JOM(4, " {\n");
JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n",\ JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n",
peasycap->audio_isoc_maxframesize); peasycap->audio_isoc_maxframesize);
JOM(4, " purb->iso_frame_desc[j].length = %i;\n", \ JOM(4, " purb->iso_frame_desc[j].length = %i;\n",
peasycap->audio_isoc_maxframesize); peasycap->audio_isoc_maxframesize);
JOM(4, " }\n"); JOM(4, " }\n");
} }
purb->interval = 1; purb->interval = 1;
purb->dev = peasycap->pusb_device; purb->dev = peasycap->pusb_device;
purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, \ purb->pipe = usb_rcvisocpipe(peasycap->pusb_device,
peasycap->audio_endpointnumber); peasycap->audio_endpointnumber);
purb->transfer_flags = URB_ISO_ASAP; purb->transfer_flags = URB_ISO_ASAP;
purb->transfer_buffer = peasycap->audio_isoc_buffer[k].pgo; purb->transfer_buffer = peasycap->audio_isoc_buffer[k].pgo;
purb->transfer_buffer_length = \ purb->transfer_buffer_length =
peasycap->audio_isoc_buffer_size; peasycap->audio_isoc_buffer_size;
#if defined(EASYCAP_NEEDS_ALSA) #if defined(EASYCAP_NEEDS_ALSA)
purb->complete = easycap_alsa_complete; purb->complete = easycap_alsa_complete;
...@@ -4703,9 +4703,9 @@ case 2: { ...@@ -4703,9 +4703,9 @@ case 2: {
purb->start_frame = 0; purb->start_frame = 0;
purb->number_of_packets = peasycap->audio_isoc_framesperdesc; purb->number_of_packets = peasycap->audio_isoc_framesperdesc;
for (j = 0; j < peasycap->audio_isoc_framesperdesc; j++) { for (j = 0; j < peasycap->audio_isoc_framesperdesc; j++) {
purb->iso_frame_desc[j].offset = j * \ purb->iso_frame_desc[j].offset = j *
peasycap->audio_isoc_maxframesize; peasycap->audio_isoc_maxframesize;
purb->iso_frame_desc[j].length = \ purb->iso_frame_desc[j].length =
peasycap->audio_isoc_maxframesize; peasycap->audio_isoc_maxframesize;
} }
} }
...@@ -4729,7 +4729,7 @@ case 2: { ...@@ -4729,7 +4729,7 @@ case 2: {
err("easycap_alsa_probe() returned %i\n", rc); err("easycap_alsa_probe() returned %i\n", rc);
return -ENODEV; return -ENODEV;
} else { } else {
JOM(8, "kref_get() with %i=peasycap->kref.refcount.counter\n",\ JOM(8, "kref_get() with %i=peasycap->kref.refcount.counter\n",
(int)peasycap->kref.refcount.counter); (int)peasycap->kref.refcount.counter);
kref_get(&peasycap->kref); kref_get(&peasycap->kref);
(peasycap->registered_audio)++; (peasycap->registered_audio)++;
...@@ -4742,7 +4742,7 @@ case 2: { ...@@ -4742,7 +4742,7 @@ case 2: {
usb_set_intfdata(pusb_interface, NULL); usb_set_intfdata(pusb_interface, NULL);
return -ENODEV; return -ENODEV;
} else { } else {
JOM(8, "kref_get() with %i=peasycap->kref.refcount.counter\n",\ JOM(8, "kref_get() with %i=peasycap->kref.refcount.counter\n",
(int)peasycap->kref.refcount.counter); (int)peasycap->kref.refcount.counter);
kref_get(&peasycap->kref); kref_get(&peasycap->kref);
(peasycap->registered_audio)++; (peasycap->registered_audio)++;
...@@ -4767,7 +4767,7 @@ default: { ...@@ -4767,7 +4767,7 @@ default: {
return -EINVAL; return -EINVAL;
} }
} }
SAM("ends successfully for interface %i\n", \ SAM("ends successfully for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber); pusb_interface_descriptor->bInterfaceNumber);
return 0; return 0;
} }
...@@ -4847,7 +4847,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { ...@@ -4847,7 +4847,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
SAY("ERROR: pv4l2_device is NULL\n"); SAY("ERROR: pv4l2_device is NULL\n");
return; return;
} }
peasycap = (struct easycap *) \ peasycap = (struct easycap *)
container_of(pv4l2_device, struct easycap, v4l2_device); container_of(pv4l2_device, struct easycap, v4l2_device);
} }
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
...@@ -4876,10 +4876,10 @@ case 0: { ...@@ -4876,10 +4876,10 @@ case 0: {
m = 0; m = 0;
list_for_each(plist_head, (peasycap->purb_video_head)) list_for_each(plist_head, (peasycap->purb_video_head))
{ {
pdata_urb = list_entry(plist_head, \ pdata_urb = list_entry(plist_head,
struct data_urb, list_head); struct data_urb, list_head);
if ((struct data_urb *)NULL != pdata_urb) { if ((struct data_urb *)NULL != pdata_urb) {
if ((struct urb *)NULL != \ if ((struct urb *)NULL !=
pdata_urb->purb) { pdata_urb->purb) {
usb_kill_urb(pdata_urb->purb); usb_kill_urb(pdata_urb->purb);
m++; m++;
...@@ -4895,12 +4895,12 @@ case 2: { ...@@ -4895,12 +4895,12 @@ case 2: {
if ((struct list_head *)NULL != peasycap->purb_audio_head) { if ((struct list_head *)NULL != peasycap->purb_audio_head) {
JOM(4, "killing audio urbs\n"); JOM(4, "killing audio urbs\n");
m = 0; m = 0;
list_for_each(plist_head, \ list_for_each(plist_head,
(peasycap->purb_audio_head)) { (peasycap->purb_audio_head)) {
pdata_urb = list_entry(plist_head, \ pdata_urb = list_entry(plist_head,
struct data_urb, list_head); struct data_urb, list_head);
if ((struct data_urb *)NULL != pdata_urb) { if ((struct data_urb *)NULL != pdata_urb) {
if ((struct urb *)NULL != \ if ((struct urb *)NULL !=
pdata_urb->purb) { pdata_urb->purb) {
usb_kill_urb(pdata_urb->purb); usb_kill_urb(pdata_urb->purb);
m++; m++;
...@@ -4929,11 +4929,11 @@ switch (bInterfaceNumber) { ...@@ -4929,11 +4929,11 @@ switch (bInterfaceNumber) {
case 0: { case 0: {
if (0 <= kd && DONGLE_MANY > kd) { if (0 <= kd && DONGLE_MANY > kd) {
wake_up_interruptible(&peasycap->wq_video); wake_up_interruptible(&peasycap->wq_video);
JOM(4, "about to lock easycapdc60_dongle[%i].mutex_video\n", \ JOM(4, "about to lock easycapdc60_dongle[%i].mutex_video\n",
kd); kd);
if (mutex_lock_interruptible(&easycapdc60_dongle[kd].\ if (mutex_lock_interruptible(&easycapdc60_dongle[kd].
mutex_video)) { mutex_video)) {
SAY("ERROR: cannot lock easycapdc60_dongle[%i]." \ SAY("ERROR: cannot lock easycapdc60_dongle[%i]."
"mutex_video\n", kd); "mutex_video\n", kd);
return; return;
} }
...@@ -4981,11 +4981,11 @@ case 0: { ...@@ -4981,11 +4981,11 @@ case 0: {
case 2: { case 2: {
if (0 <= kd && DONGLE_MANY > kd) { if (0 <= kd && DONGLE_MANY > kd) {
wake_up_interruptible(&peasycap->wq_audio); wake_up_interruptible(&peasycap->wq_audio);
JOM(4, "about to lock easycapdc60_dongle[%i].mutex_audio\n", \ JOM(4, "about to lock easycapdc60_dongle[%i].mutex_audio\n",
kd); kd);
if (mutex_lock_interruptible(&easycapdc60_dongle[kd].\ if (mutex_lock_interruptible(&easycapdc60_dongle[kd].
mutex_audio)) { mutex_audio)) {
SAY("ERROR: cannot lock easycapdc60_dongle[%i]." \ SAY("ERROR: cannot lock easycapdc60_dongle[%i]."
"mutex_audio\n", kd); "mutex_audio\n", kd);
return; return;
} }
...@@ -5052,7 +5052,7 @@ if (0 <= kd && DONGLE_MANY > kd) { ...@@ -5052,7 +5052,7 @@ if (0 <= kd && DONGLE_MANY > kd) {
} }
JOM(4, "locked easycapdc60_dongle[%i].mutex_audio\n", kd); JOM(4, "locked easycapdc60_dongle[%i].mutex_audio\n", kd);
} }
JOM(4, "intf[%i]: %i=peasycap->kref.refcount.counter\n", \ JOM(4, "intf[%i]: %i=peasycap->kref.refcount.counter\n",
bInterfaceNumber, (int)peasycap->kref.refcount.counter); bInterfaceNumber, (int)peasycap->kref.refcount.counter);
kref_put(&peasycap->kref, easycap_delete); kref_put(&peasycap->kref, easycap_delete);
JOT(4, "intf[%i]: kref_put() done.\n", bInterfaceNumber); JOT(4, "intf[%i]: kref_put() done.\n", bInterfaceNumber);
...@@ -5073,7 +5073,7 @@ easycap_module_init(void) ...@@ -5073,7 +5073,7 @@ easycap_module_init(void)
int k, rc; int k, rc;
SAY("========easycap=======\n"); SAY("========easycap=======\n");
JOT(4, "begins. %i=debug %i=bars %i=gain\n", easycap_debug, easycap_bars, \ JOT(4, "begins. %i=debug %i=bars %i=gain\n", easycap_debug, easycap_bars,
easycap_gain); easycap_gain);
SAY("version: " EASYCAP_DRIVER_VERSION "\n"); SAY("version: " EASYCAP_DRIVER_VERSION "\n");
...@@ -5123,7 +5123,7 @@ MODULE_VERSION(EASYCAP_DRIVER_VERSION); ...@@ -5123,7 +5123,7 @@ MODULE_VERSION(EASYCAP_DRIVER_VERSION);
#if defined(EASYCAP_DEBUG) #if defined(EASYCAP_DEBUG)
MODULE_PARM_DESC(debug, "Debug level: 0(default),1,2,...,9"); MODULE_PARM_DESC(debug, "Debug level: 0(default),1,2,...,9");
#endif /*EASYCAP_DEBUG*/ #endif /*EASYCAP_DEBUG*/
MODULE_PARM_DESC(bars, \ MODULE_PARM_DESC(bars,
"Testcard bars on input signal failure: 0=>no, 1=>yes(default)"); "Testcard bars on input signal failure: 0=>no, 1=>yes(default)");
MODULE_PARM_DESC(gain, "Audio gain: 0,...,16(default),...31"); MODULE_PARM_DESC(gain, "Audio gain: 0,...,16(default),...31");
/*****************************************************************************/ /*****************************************************************************/
...@@ -44,7 +44,7 @@ const struct easycap_standard easycap_standard[] = { ...@@ -44,7 +44,7 @@ const struct easycap_standard easycap_standard[] = {
.mask = 0x00FF & PAL_BGHIN , .mask = 0x00FF & PAL_BGHIN ,
.v4l2_standard = { .v4l2_standard = {
.index = PAL_BGHIN, .index = PAL_BGHIN,
.id = (V4L2_STD_PAL_B | V4L2_STD_PAL_G | V4L2_STD_PAL_H | \ .id = (V4L2_STD_PAL_B | V4L2_STD_PAL_G | V4L2_STD_PAL_H |
V4L2_STD_PAL_I | V4L2_STD_PAL_N), V4L2_STD_PAL_I | V4L2_STD_PAL_N),
.name = "PAL_BGHIN", .name = "PAL_BGHIN",
.frameperiod = {1, 25}, .frameperiod = {1, 25},
...@@ -165,8 +165,8 @@ const struct easycap_standard easycap_standard[] = { ...@@ -165,8 +165,8 @@ const struct easycap_standard easycap_standard[] = {
.mask = 0x8000 | (0x00FF & PAL_BGHIN_SLOW), .mask = 0x8000 | (0x00FF & PAL_BGHIN_SLOW),
.v4l2_standard = { .v4l2_standard = {
.index = PAL_BGHIN_SLOW, .index = PAL_BGHIN_SLOW,
.id = (V4L2_STD_PAL_B | V4L2_STD_PAL_G | V4L2_STD_PAL_H | \ .id = (V4L2_STD_PAL_B | V4L2_STD_PAL_G | V4L2_STD_PAL_H |
V4L2_STD_PAL_I | V4L2_STD_PAL_N | \ V4L2_STD_PAL_I | V4L2_STD_PAL_N |
(((v4l2_std_id)0x01) << 32)), (((v4l2_std_id)0x01) << 32)),
.name = "PAL_BGHIN_SLOW", .name = "PAL_BGHIN_SLOW",
.frameperiod = {1, 5}, .frameperiod = {1, 5},
...@@ -573,25 +573,25 @@ for (i = 0, n = 0; i < STANDARD_MANY; i++) { ...@@ -573,25 +573,25 @@ for (i = 0, n = 0; i < STANDARD_MANY; i++) {
strcat(&easycap_format[n].name[0], &name2[0]); strcat(&easycap_format[n].name[0], &name2[0]);
strcat(&easycap_format[n].name[0], &name3[0]); strcat(&easycap_format[n].name[0], &name3[0]);
strcat(&easycap_format[n].name[0], &name4[0]); strcat(&easycap_format[n].name[0], &name4[0]);
easycap_format[n].mask = \ easycap_format[n].mask =
mask1 | mask2 | mask3 | mask4; mask1 | mask2 | mask3 | mask4;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; .type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.width = width; .fmt.pix.width = width;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.height = height; .fmt.pix.height = height;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.pixelformat = pixelformat; .fmt.pix.pixelformat = pixelformat;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.field = field; .fmt.pix.field = field;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.bytesperline = bytesperline; .fmt.pix.bytesperline = bytesperline;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.sizeimage = sizeimage; .fmt.pix.sizeimage = sizeimage;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.colorspace = colorspace; .fmt.pix.colorspace = colorspace;
easycap_format[n].v4l2_format\ easycap_format[n].v4l2_format
.fmt.pix.priv = 0; .fmt.pix.priv = 0;
n++; n++;
} }
...@@ -604,7 +604,7 @@ easycap_format[n].mask = 0xFFFF; ...@@ -604,7 +604,7 @@ easycap_format[n].mask = 0xFFFF;
return n; return n;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct v4l2_queryctrl easycap_control[] = \ struct v4l2_queryctrl easycap_control[] =
{{ {{
.id = V4L2_CID_BRIGHTNESS, .id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
......
...@@ -48,7 +48,7 @@ static const struct snd_pcm_hardware alsa_hardware = { ...@@ -48,7 +48,7 @@ static const struct snd_pcm_hardware alsa_hardware = {
.rate_max = 48000, .rate_max = 48000,
.channels_min = 2, .channels_min = 2,
.channels_max = 2, .channels_max = 2,
.buffer_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT * \ .buffer_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT *
AUDIO_FRAGMENT_MANY, AUDIO_FRAGMENT_MANY,
.period_bytes_min = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT, .period_bytes_min = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT,
.period_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT * 2, .period_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT * 2,
...@@ -108,14 +108,14 @@ if (true == peasycap->microphone) { ...@@ -108,14 +108,14 @@ if (true == peasycap->microphone) {
} }
#if defined(EASYCAP_NEEDS_CARD_CREATE) #if defined(EASYCAP_NEEDS_CARD_CREATE)
if (0 != snd_card_create(SNDRV_DEFAULT_IDX1, "easycap_alsa", \ if (0 != snd_card_create(SNDRV_DEFAULT_IDX1, "easycap_alsa",
THIS_MODULE, 0, \ THIS_MODULE, 0,
&psnd_card)) { &psnd_card)) {
SAY("ERROR: Cannot do ALSA snd_card_create()\n"); SAY("ERROR: Cannot do ALSA snd_card_create()\n");
return -EFAULT; return -EFAULT;
} }
#else #else
psnd_card = snd_card_new(SNDRV_DEFAULT_IDX1, "easycap_alsa", \ psnd_card = snd_card_new(SNDRV_DEFAULT_IDX1, "easycap_alsa",
THIS_MODULE, 0); THIS_MODULE, 0);
if (NULL == psnd_card) { if (NULL == psnd_card) {
SAY("ERROR: Cannot do ALSA snd_card_new()\n"); SAY("ERROR: Cannot do ALSA snd_card_new()\n");
...@@ -139,7 +139,7 @@ if (true == peasycap->microphone) { ...@@ -139,7 +139,7 @@ if (true == peasycap->microphone) {
return -EFAULT; return -EFAULT;
} }
snd_pcm_set_ops(psnd_pcm, SNDRV_PCM_STREAM_CAPTURE, \ snd_pcm_set_ops(psnd_pcm, SNDRV_PCM_STREAM_CAPTURE,
&easycap_alsa_pcm_ops); &easycap_alsa_pcm_ops);
psnd_pcm->info_flags = 0; psnd_pcm->info_flags = 0;
strcpy(&psnd_pcm->name[0], &psnd_card->id[0]); strcpy(&psnd_pcm->name[0], &psnd_card->id[0]);
...@@ -199,7 +199,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { ...@@ -199,7 +199,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
} }
much = 0; much = 0;
if (peasycap->audio_idle) { if (peasycap->audio_idle) {
JOM(16, "%i=audio_idle %i=audio_isoc_streaming\n", \ JOM(16, "%i=audio_idle %i=audio_isoc_streaming\n",
peasycap->audio_idle, peasycap->audio_isoc_streaming); peasycap->audio_idle, peasycap->audio_isoc_streaming);
if (peasycap->audio_isoc_streaming) if (peasycap->audio_isoc_streaming)
goto resubmit; goto resubmit;
...@@ -410,12 +410,12 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -410,12 +410,12 @@ for (i = 0; i < purb->number_of_packets; i++) {
peasycap->audio_mt++; peasycap->audio_mt++;
else { else {
if (peasycap->audio_mt) { if (peasycap->audio_mt) {
JOM(12, "%4i empty audio urb frames\n", \ JOM(12, "%4i empty audio urb frames\n",
peasycap->audio_mt); peasycap->audio_mt);
peasycap->audio_mt = 0; peasycap->audio_mt = 0;
} }
p1 = (__u8 *)(purb->transfer_buffer + \ p1 = (__u8 *)(purb->transfer_buffer +
purb->iso_frame_desc[i].offset); purb->iso_frame_desc[i].offset);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -442,39 +442,39 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -442,39 +442,39 @@ for (i = 0; i < purb->number_of_packets; i++) {
if (false == peasycap->microphone) { if (false == peasycap->microphone) {
if (much > more) if (much > more)
much = more; much = more;
memcpy(prt->dma_area + \ memcpy(prt->dma_area +
peasycap->dma_fill, \ peasycap->dma_fill,
p1, much); p1, much);
p1 += much; p1 += much;
more -= much; more -= much;
} else { } else {
#if defined(UPSAMPLE) #if defined(UPSAMPLE)
if (much % 16) if (much % 16)
JOM(8, "MISTAKE? much" \ JOM(8, "MISTAKE? much"
" is not divisible by 16\n"); " is not divisible by 16\n");
if (much > (16 * \ if (much > (16 *
more)) more))
much = 16 * \ much = 16 *
more; more;
p2 = (__u8 *)(prt->dma_area + \ p2 = (__u8 *)(prt->dma_area +
peasycap->dma_fill); peasycap->dma_fill);
for (j = 0; j < (much/16); j++) { for (j = 0; j < (much/16); j++) {
newaudio = ((int) *p1) - 128; newaudio = ((int) *p1) - 128;
newaudio = 128 * \ newaudio = 128 *
newaudio; newaudio;
delta = (newaudio - oldaudio) \ delta = (newaudio - oldaudio)
/ 4; / 4;
s16 = oldaudio + delta; s16 = oldaudio + delta;
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
*p2 = (0x00FF & s16); *p2 = (0x00FF & s16);
*(p2 + 1) = (0xFF00 & \ *(p2 + 1) = (0xFF00 &
s16) >> 8; s16) >> 8;
p2 += 2; p2 += 2;
*p2 = (0x00FF & s16); *p2 = (0x00FF & s16);
*(p2 + 1) = (0xFF00 & \ *(p2 + 1) = (0xFF00 &
s16) >> 8; s16) >> 8;
p2 += 2; p2 += 2;
s16 += delta; s16 += delta;
...@@ -486,15 +486,15 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -486,15 +486,15 @@ for (i = 0; i < purb->number_of_packets; i++) {
#else /*!UPSAMPLE*/ #else /*!UPSAMPLE*/
if (much > (2 * more)) if (much > (2 * more))
much = 2 * more; much = 2 * more;
p2 = (__u8 *)(prt->dma_area + \ p2 = (__u8 *)(prt->dma_area +
peasycap->dma_fill); peasycap->dma_fill);
for (j = 0; j < (much / 2); j++) { for (j = 0; j < (much / 2); j++) {
s16 = ((int) *p1) - 128; s16 = ((int) *p1) - 128;
s16 = 128 * \ s16 = 128 *
s16; s16;
*p2 = (0x00FF & s16); *p2 = (0x00FF & s16);
*(p2 + 1) = (0xFF00 & s16) >> \ *(p2 + 1) = (0xFF00 & s16) >>
8; 8;
p1++; p2 += 2; p1++; p2 += 2;
more--; more--;
...@@ -503,25 +503,25 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -503,25 +503,25 @@ for (i = 0; i < purb->number_of_packets; i++) {
} }
peasycap->dma_fill += much; peasycap->dma_fill += much;
if (peasycap->dma_fill >= peasycap->dma_next) { if (peasycap->dma_fill >= peasycap->dma_next) {
isfragment = peasycap->dma_fill / \ isfragment = peasycap->dma_fill /
fragment_bytes; fragment_bytes;
if (0 > isfragment) { if (0 > isfragment) {
SAM("MISTAKE: isfragment is " \ SAM("MISTAKE: isfragment is "
"negative\n"); "negative\n");
return; return;
} }
peasycap->dma_read = (isfragment \ peasycap->dma_read = (isfragment
- 1) * fragment_bytes; - 1) * fragment_bytes;
peasycap->dma_next = (isfragment \ peasycap->dma_next = (isfragment
+ 1) * fragment_bytes; + 1) * fragment_bytes;
if (dma_bytes < peasycap->dma_next) { if (dma_bytes < peasycap->dma_next) {
peasycap->dma_next = \ peasycap->dma_next =
fragment_bytes; fragment_bytes;
} }
if (0 <= peasycap->dma_read) { if (0 <= peasycap->dma_read) {
JOM(8, "snd_pcm_period_elap" \ JOM(8, "snd_pcm_period_elap"
"sed(), %i=" \ "sed(), %i="
"isfragment\n", \ "isfragment\n",
isfragment); isfragment);
snd_pcm_period_elapsed(pss); snd_pcm_period_elapsed(pss);
} }
...@@ -529,8 +529,8 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -529,8 +529,8 @@ for (i = 0; i < purb->number_of_packets; i++) {
} }
} }
} else { } else {
JOM(12, "discarding audio samples because " \ JOM(12, "discarding audio samples because "
"%i=purb->iso_frame_desc[i].status\n", \ "%i=purb->iso_frame_desc[i].status\n",
purb->iso_frame_desc[i].status); purb->iso_frame_desc[i].status);
} }
...@@ -549,8 +549,8 @@ if (peasycap->audio_isoc_streaming) { ...@@ -549,8 +549,8 @@ if (peasycap->audio_isoc_streaming) {
rc = usb_submit_urb(purb, GFP_ATOMIC); rc = usb_submit_urb(purb, GFP_ATOMIC);
if (0 != rc) { if (0 != rc) {
if ((-ENODEV != rc) && (-ENOENT != rc)) { if ((-ENODEV != rc) && (-ENOENT != rc)) {
SAM("ERROR: while %i=audio_idle, " \ SAM("ERROR: while %i=audio_idle, "
"usb_submit_urb() failed " \ "usb_submit_urb() failed "
"with rc:\n", peasycap->audio_idle); "with rc:\n", peasycap->audio_idle);
} }
switch (rc) { switch (rc) {
...@@ -685,7 +685,7 @@ return 0; ...@@ -685,7 +685,7 @@ return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
int int
easycap_alsa_hw_params(struct snd_pcm_substream *pss, \ easycap_alsa_hw_params(struct snd_pcm_substream *pss,
struct snd_pcm_hw_params *phw) struct snd_pcm_hw_params *phw)
{ {
int rc; int rc;
...@@ -785,7 +785,7 @@ JOM(16, "ALSA decides %8i =sample_bits\n", (int)pss->runtime->sample_bits); ...@@ -785,7 +785,7 @@ JOM(16, "ALSA decides %8i =sample_bits\n", (int)pss->runtime->sample_bits);
JOM(16, "ALSA decides %8i =frame_bits\n", (int)pss->runtime->frame_bits); JOM(16, "ALSA decides %8i =frame_bits\n", (int)pss->runtime->frame_bits);
JOM(16, "ALSA decides %8i =min_align\n", (int)pss->runtime->min_align); JOM(16, "ALSA decides %8i =min_align\n", (int)pss->runtime->min_align);
JOM(12, "ALSA decides %8i =hw_ptr_base\n", (int)pss->runtime->hw_ptr_base); JOM(12, "ALSA decides %8i =hw_ptr_base\n", (int)pss->runtime->hw_ptr_base);
JOM(12, "ALSA decides %8i =hw_ptr_interrupt\n", \ JOM(12, "ALSA decides %8i =hw_ptr_interrupt\n",
(int)pss->runtime->hw_ptr_interrupt); (int)pss->runtime->hw_ptr_interrupt);
if (prt->dma_bytes != 4 * ((int)prt->period_size) * ((int)prt->periods)) { if (prt->dma_bytes != 4 * ((int)prt->period_size) * ((int)prt->periods)) {
SAY("MISTAKE: unexpected ALSA parameters\n"); SAY("MISTAKE: unexpected ALSA parameters\n");
...@@ -806,7 +806,7 @@ easycap_alsa_trigger(struct snd_pcm_substream *pss, int cmd) ...@@ -806,7 +806,7 @@ easycap_alsa_trigger(struct snd_pcm_substream *pss, int cmd)
struct easycap *peasycap; struct easycap *peasycap;
int retval; int retval;
JOT(4, "%i=cmd cf %i=START %i=STOP\n", cmd, SNDRV_PCM_TRIGGER_START, \ JOT(4, "%i=cmd cf %i=START %i=STOP\n", cmd, SNDRV_PCM_TRIGGER_START,
SNDRV_PCM_TRIGGER_STOP); SNDRV_PCM_TRIGGER_STOP);
if (NULL == pss) { if (NULL == pss) {
SAY("ERROR: pss is NULL\n"); SAY("ERROR: pss is NULL\n");
...@@ -858,8 +858,8 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { ...@@ -858,8 +858,8 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
return -EFAULT; return -EFAULT;
} }
if ((0 != peasycap->audio_eof) || (0 != peasycap->audio_idle)) { if ((0 != peasycap->audio_eof) || (0 != peasycap->audio_idle)) {
JOM(8, "returning -EIO because " \ JOM(8, "returning -EIO because "
"%i=audio_idle %i=audio_eof\n", \ "%i=audio_idle %i=audio_eof\n",
peasycap->audio_idle, peasycap->audio_eof); peasycap->audio_idle, peasycap->audio_eof);
return -EIO; return -EIO;
} }
...@@ -870,9 +870,9 @@ if (0 > peasycap->dma_read) { ...@@ -870,9 +870,9 @@ if (0 > peasycap->dma_read) {
} }
offset = ((snd_pcm_uframes_t)peasycap->dma_read)/4; offset = ((snd_pcm_uframes_t)peasycap->dma_read)/4;
JOM(8, "ALSA decides %8i =hw_ptr_base\n", (int)pss->runtime->hw_ptr_base); JOM(8, "ALSA decides %8i =hw_ptr_base\n", (int)pss->runtime->hw_ptr_base);
JOM(8, "ALSA decides %8i =hw_ptr_interrupt\n", \ JOM(8, "ALSA decides %8i =hw_ptr_interrupt\n",
(int)pss->runtime->hw_ptr_interrupt); (int)pss->runtime->hw_ptr_interrupt);
JOM(8, "%7i=offset %7i=dma_read %7i=dma_next\n", \ JOM(8, "%7i=offset %7i=dma_read %7i=dma_next\n",
(int)offset, peasycap->dma_read, peasycap->dma_next); (int)offset, peasycap->dma_read, peasycap->dma_next);
return offset; return offset;
} }
...@@ -951,14 +951,14 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { ...@@ -951,14 +951,14 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
} }
much = 0; much = 0;
if (peasycap->audio_idle) { if (peasycap->audio_idle) {
JOM(16, "%i=audio_idle %i=audio_isoc_streaming\n", \ JOM(16, "%i=audio_idle %i=audio_isoc_streaming\n",
peasycap->audio_idle, peasycap->audio_isoc_streaming); peasycap->audio_idle, peasycap->audio_isoc_streaming);
if (peasycap->audio_isoc_streaming) { if (peasycap->audio_isoc_streaming) {
rc = usb_submit_urb(purb, GFP_ATOMIC); rc = usb_submit_urb(purb, GFP_ATOMIC);
if (0 != rc) { if (0 != rc) {
if (-ENODEV != rc && -ENOENT != rc) { if (-ENODEV != rc && -ENOENT != rc) {
SAM("ERROR: while %i=audio_idle, " \ SAM("ERROR: while %i=audio_idle, "
"usb_submit_urb() failed with rc:\n", \ "usb_submit_urb() failed with rc:\n",
peasycap->audio_idle); peasycap->audio_idle);
} }
switch (rc) { switch (rc) {
...@@ -1212,12 +1212,12 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -1212,12 +1212,12 @@ for (i = 0; i < purb->number_of_packets; i++) {
peasycap->audio_mt++; peasycap->audio_mt++;
else { else {
if (peasycap->audio_mt) { if (peasycap->audio_mt) {
JOM(12, "%4i empty audio urb frames\n", \ JOM(12, "%4i empty audio urb frames\n",
peasycap->audio_mt); peasycap->audio_mt);
peasycap->audio_mt = 0; peasycap->audio_mt = 0;
} }
p1 = (__u8 *)(purb->transfer_buffer + \ p1 = (__u8 *)(purb->transfer_buffer +
purb->iso_frame_desc[i].offset); purb->iso_frame_desc[i].offset);
leap = 0; leap = 0;
...@@ -1234,64 +1234,64 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -1234,64 +1234,64 @@ for (i = 0; i < purb->number_of_packets; i++) {
SAM("MISTAKE: more is negative\n"); SAM("MISTAKE: more is negative\n");
return; return;
} }
if (peasycap->audio_buffer_page_many <= \ if (peasycap->audio_buffer_page_many <=
peasycap->audio_fill) { peasycap->audio_fill) {
SAM("ERROR: bad " \ SAM("ERROR: bad "
"peasycap->audio_fill\n"); "peasycap->audio_fill\n");
return; return;
} }
paudio_buffer = &peasycap->audio_buffer\ paudio_buffer = &peasycap->audio_buffer
[peasycap->audio_fill]; [peasycap->audio_fill];
if (PAGE_SIZE < (paudio_buffer->pto - \ if (PAGE_SIZE < (paudio_buffer->pto -
paudio_buffer->pgo)) { paudio_buffer->pgo)) {
SAM("ERROR: bad paudio_buffer->pto\n"); SAM("ERROR: bad paudio_buffer->pto\n");
return; return;
} }
if (PAGE_SIZE == (paudio_buffer->pto - \ if (PAGE_SIZE == (paudio_buffer->pto -
paudio_buffer->pgo)) { paudio_buffer->pgo)) {
#if defined(TESTTONE) #if defined(TESTTONE)
easyoss_testtone(peasycap, \ easyoss_testtone(peasycap,
peasycap->audio_fill); peasycap->audio_fill);
#endif /*TESTTONE*/ #endif /*TESTTONE*/
paudio_buffer->pto = \ paudio_buffer->pto =
paudio_buffer->pgo; paudio_buffer->pgo;
(peasycap->audio_fill)++; (peasycap->audio_fill)++;
if (peasycap->\ if (peasycap->
audio_buffer_page_many <= \ audio_buffer_page_many <=
peasycap->audio_fill) peasycap->audio_fill)
peasycap->audio_fill = 0; peasycap->audio_fill = 0;
JOM(8, "bumped peasycap->" \ JOM(8, "bumped peasycap->"
"audio_fill to %i\n", \ "audio_fill to %i\n",
peasycap->audio_fill); peasycap->audio_fill);
paudio_buffer = &peasycap->\ paudio_buffer = &peasycap->
audio_buffer\ audio_buffer
[peasycap->audio_fill]; [peasycap->audio_fill];
paudio_buffer->pto = \ paudio_buffer->pto =
paudio_buffer->pgo; paudio_buffer->pgo;
if (!(peasycap->audio_fill % \ if (!(peasycap->audio_fill %
peasycap->\ peasycap->
audio_pages_per_fragment)) { audio_pages_per_fragment)) {
JOM(12, "wakeup call on wq_" \ JOM(12, "wakeup call on wq_"
"audio, %i=frag reading %i" \ "audio, %i=frag reading %i"
"=fragment fill\n", \ "=fragment fill\n",
(peasycap->audio_read / \ (peasycap->audio_read /
peasycap->\ peasycap->
audio_pages_per_fragment), \ audio_pages_per_fragment),
(peasycap->audio_fill / \ (peasycap->audio_fill /
peasycap->\ peasycap->
audio_pages_per_fragment)); audio_pages_per_fragment));
wake_up_interruptible\ wake_up_interruptible
(&(peasycap->wq_audio)); (&(peasycap->wq_audio));
} }
} }
much = PAGE_SIZE - (int)(paudio_buffer->pto -\ much = PAGE_SIZE - (int)(paudio_buffer->pto -
paudio_buffer->pgo); paudio_buffer->pgo);
if (false == peasycap->microphone) { if (false == peasycap->microphone) {
...@@ -1304,30 +1304,30 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -1304,30 +1304,30 @@ for (i = 0; i < purb->number_of_packets; i++) {
} else { } else {
#if defined(UPSAMPLE) #if defined(UPSAMPLE)
if (much % 16) if (much % 16)
JOM(8, "MISTAKE? much" \ JOM(8, "MISTAKE? much"
" is not divisible by 16\n"); " is not divisible by 16\n");
if (much > (16 * \ if (much > (16 *
more)) more))
much = 16 * \ much = 16 *
more; more;
p2 = (__u8 *)paudio_buffer->pto; p2 = (__u8 *)paudio_buffer->pto;
for (j = 0; j < (much/16); j++) { for (j = 0; j < (much/16); j++) {
newaudio = ((int) *p1) - 128; newaudio = ((int) *p1) - 128;
newaudio = 128 * \ newaudio = 128 *
newaudio; newaudio;
delta = (newaudio - oldaudio) \ delta = (newaudio - oldaudio)
/ 4; / 4;
s16 = oldaudio + delta; s16 = oldaudio + delta;
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
*p2 = (0x00FF & s16); *p2 = (0x00FF & s16);
*(p2 + 1) = (0xFF00 & \ *(p2 + 1) = (0xFF00 &
s16) >> 8; s16) >> 8;
p2 += 2; p2 += 2;
*p2 = (0x00FF & s16); *p2 = (0x00FF & s16);
*(p2 + 1) = (0xFF00 & \ *(p2 + 1) = (0xFF00 &
s16) >> 8; s16) >> 8;
p2 += 2; p2 += 2;
...@@ -1344,10 +1344,10 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -1344,10 +1344,10 @@ for (i = 0; i < purb->number_of_packets; i++) {
for (j = 0; j < (much / 2); j++) { for (j = 0; j < (much / 2); j++) {
s16 = ((int) *p1) - 128; s16 = ((int) *p1) - 128;
s16 = 128 * \ s16 = 128 *
s16; s16;
*p2 = (0x00FF & s16); *p2 = (0x00FF & s16);
*(p2 + 1) = (0xFF00 & s16) >> \ *(p2 + 1) = (0xFF00 & s16) >>
8; 8;
p1++; p2 += 2; p1++; p2 += 2;
more--; more--;
...@@ -1358,8 +1358,8 @@ for (i = 0; i < purb->number_of_packets; i++) { ...@@ -1358,8 +1358,8 @@ for (i = 0; i < purb->number_of_packets; i++) {
} }
} }
} else { } else {
JOM(12, "discarding audio samples because " \ JOM(12, "discarding audio samples because "
"%i=purb->iso_frame_desc[i].status\n", \ "%i=purb->iso_frame_desc[i].status\n",
purb->iso_frame_desc[i].status); purb->iso_frame_desc[i].status);
} }
...@@ -1378,8 +1378,8 @@ if (peasycap->audio_isoc_streaming) { ...@@ -1378,8 +1378,8 @@ if (peasycap->audio_isoc_streaming) {
rc = usb_submit_urb(purb, GFP_ATOMIC); rc = usb_submit_urb(purb, GFP_ATOMIC);
if (0 != rc) { if (0 != rc) {
if (-ENODEV != rc && -ENOENT != rc) { if (-ENODEV != rc && -ENOENT != rc) {
SAM("ERROR: while %i=audio_idle, " \ SAM("ERROR: while %i=audio_idle, "
"usb_submit_urb() failed " \ "usb_submit_urb() failed "
"with rc:\n", peasycap->audio_idle); "with rc:\n", peasycap->audio_idle);
} }
switch (rc) { switch (rc) {
...@@ -1489,7 +1489,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { ...@@ -1489,7 +1489,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
SAY("ERROR: pv4l2_device is NULL\n"); SAY("ERROR: pv4l2_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
peasycap = (struct easycap *) \ peasycap = (struct easycap *)
container_of(pv4l2_device, struct easycap, v4l2_device); container_of(pv4l2_device, struct easycap, v4l2_device);
} }
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
...@@ -1537,7 +1537,7 @@ return 0; ...@@ -1537,7 +1537,7 @@ return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
ssize_t ssize_t
easyoss_read(struct file *file, char __user *puserspacebuffer, \ easyoss_read(struct file *file, char __user *puserspacebuffer,
size_t kount, loff_t *poff) size_t kount, loff_t *poff)
{ {
struct timeval timeval; struct timeval timeval;
...@@ -1609,7 +1609,7 @@ if (0 <= kd && DONGLE_MANY > kd) { ...@@ -1609,7 +1609,7 @@ if (0 <= kd && DONGLE_MANY > kd) {
return -ERESTARTSYS; return -ERESTARTSYS;
} }
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
SAY("ERROR: bad peasycap: 0x%08lX\n", \ SAY("ERROR: bad peasycap: 0x%08lX\n",
(unsigned long int) peasycap); (unsigned long int) peasycap);
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -1634,7 +1634,7 @@ if (file->f_flags & O_NONBLOCK) ...@@ -1634,7 +1634,7 @@ if (file->f_flags & O_NONBLOCK)
else else
JOT(8, "BLOCKING kount=%i, *poff=%i\n", (int)kount, (int)(*poff)); JOT(8, "BLOCKING kount=%i, *poff=%i\n", (int)kount, (int)(*poff));
if ((0 > peasycap->audio_read) || \ if ((0 > peasycap->audio_read) ||
(peasycap->audio_buffer_page_many <= peasycap->audio_read)) { (peasycap->audio_buffer_page_many <= peasycap->audio_read)) {
SAM("ERROR: peasycap->audio_read out of range\n"); SAM("ERROR: peasycap->audio_read out of range\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
...@@ -1646,22 +1646,22 @@ if ((struct data_buffer *)NULL == pdata_buffer) { ...@@ -1646,22 +1646,22 @@ if ((struct data_buffer *)NULL == pdata_buffer) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -EFAULT; return -EFAULT;
} }
JOM(12, "before wait, %i=frag read %i=frag fill\n", \ JOM(12, "before wait, %i=frag read %i=frag fill\n",
(peasycap->audio_read / peasycap->audio_pages_per_fragment), \ (peasycap->audio_read / peasycap->audio_pages_per_fragment),
(peasycap->audio_fill / peasycap->audio_pages_per_fragment)); (peasycap->audio_fill / peasycap->audio_pages_per_fragment));
fragment = (peasycap->audio_read / peasycap->audio_pages_per_fragment); fragment = (peasycap->audio_read / peasycap->audio_pages_per_fragment);
while ((fragment == (peasycap->audio_fill / \ while ((fragment == (peasycap->audio_fill /
peasycap->audio_pages_per_fragment)) || \ peasycap->audio_pages_per_fragment)) ||
(0 == (PAGE_SIZE - (pdata_buffer->pto - pdata_buffer->pgo)))) { (0 == (PAGE_SIZE - (pdata_buffer->pto - pdata_buffer->pgo)))) {
if (file->f_flags & O_NONBLOCK) { if (file->f_flags & O_NONBLOCK) {
JOM(16, "returning -EAGAIN as instructed\n"); JOM(16, "returning -EAGAIN as instructed\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -EAGAIN; return -EAGAIN;
} }
rc = wait_event_interruptible(peasycap->wq_audio, \ rc = wait_event_interruptible(peasycap->wq_audio,
(peasycap->audio_idle || peasycap->audio_eof || \ (peasycap->audio_idle || peasycap->audio_eof ||
((fragment != (peasycap->audio_fill / \ ((fragment != (peasycap->audio_fill /
peasycap->audio_pages_per_fragment)) && \ peasycap->audio_pages_per_fragment)) &&
(0 < (PAGE_SIZE - (pdata_buffer->pto - pdata_buffer->pgo)))))); (0 < (PAGE_SIZE - (pdata_buffer->pto - pdata_buffer->pgo))))));
if (0 != rc) { if (0 != rc) {
SAM("aborted by signal\n"); SAM("aborted by signal\n");
...@@ -1669,14 +1669,14 @@ while ((fragment == (peasycap->audio_fill / \ ...@@ -1669,14 +1669,14 @@ while ((fragment == (peasycap->audio_fill / \
return -ERESTARTSYS; return -ERESTARTSYS;
} }
if (peasycap->audio_eof) { if (peasycap->audio_eof) {
JOM(8, "returning 0 because %i=audio_eof\n", \ JOM(8, "returning 0 because %i=audio_eof\n",
peasycap->audio_eof); peasycap->audio_eof);
kill_audio_urbs(peasycap); kill_audio_urbs(peasycap);
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return 0; return 0;
} }
if (peasycap->audio_idle) { if (peasycap->audio_idle) {
JOM(16, "returning 0 because %i=audio_idle\n", \ JOM(16, "returning 0 because %i=audio_idle\n",
peasycap->audio_idle); peasycap->audio_idle);
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return 0; return 0;
...@@ -1687,12 +1687,12 @@ while ((fragment == (peasycap->audio_fill / \ ...@@ -1687,12 +1687,12 @@ while ((fragment == (peasycap->audio_fill / \
return 0; return 0;
} }
} }
JOM(12, "after wait, %i=frag read %i=frag fill\n", \ JOM(12, "after wait, %i=frag read %i=frag fill\n",
(peasycap->audio_read / peasycap->audio_pages_per_fragment), \ (peasycap->audio_read / peasycap->audio_pages_per_fragment),
(peasycap->audio_fill / peasycap->audio_pages_per_fragment)); (peasycap->audio_fill / peasycap->audio_pages_per_fragment));
szret = (size_t)0; szret = (size_t)0;
fragment = (peasycap->audio_read / peasycap->audio_pages_per_fragment); fragment = (peasycap->audio_read / peasycap->audio_pages_per_fragment);
while (fragment == (peasycap->audio_read / \ while (fragment == (peasycap->audio_read /
peasycap->audio_pages_per_fragment)) { peasycap->audio_pages_per_fragment)) {
if (NULL == pdata_buffer->pgo) { if (NULL == pdata_buffer->pgo) {
SAM("ERROR: pdata_buffer->pgo is NULL\n"); SAM("ERROR: pdata_buffer->pgo is NULL\n");
...@@ -1714,15 +1714,15 @@ while (fragment == (peasycap->audio_read / \ ...@@ -1714,15 +1714,15 @@ while (fragment == (peasycap->audio_read / \
(peasycap->audio_read)++; (peasycap->audio_read)++;
if (peasycap->audio_buffer_page_many <= peasycap->audio_read) if (peasycap->audio_buffer_page_many <= peasycap->audio_read)
peasycap->audio_read = 0; peasycap->audio_read = 0;
JOM(12, "bumped peasycap->audio_read to %i\n", \ JOM(12, "bumped peasycap->audio_read to %i\n",
peasycap->audio_read); peasycap->audio_read);
if (fragment != (peasycap->audio_read / \ if (fragment != (peasycap->audio_read /
peasycap->audio_pages_per_fragment)) peasycap->audio_pages_per_fragment))
break; break;
if ((0 > peasycap->audio_read) || \ if ((0 > peasycap->audio_read) ||
(peasycap->audio_buffer_page_many <= \ (peasycap->audio_buffer_page_many <=
peasycap->audio_read)) { peasycap->audio_read)) {
SAM("ERROR: peasycap->audio_read out of range\n"); SAM("ERROR: peasycap->audio_read out of range\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
...@@ -1751,7 +1751,7 @@ while (fragment == (peasycap->audio_read / \ ...@@ -1751,7 +1751,7 @@ while (fragment == (peasycap->audio_read / \
more = kount1; more = kount1;
if (more > kount) if (more > kount)
more = kount; more = kount;
JOM(12, "agreed to send %li bytes from page %i\n", \ JOM(12, "agreed to send %li bytes from page %i\n",
more, peasycap->audio_read); more, peasycap->audio_read);
if (!more) if (!more)
break; break;
...@@ -1763,7 +1763,7 @@ while (fragment == (peasycap->audio_read / \ ...@@ -1763,7 +1763,7 @@ while (fragment == (peasycap->audio_read / \
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
p0 = (unsigned char *)pdata_buffer->pgo; l0 = 0; lm = more/2; p0 = (unsigned char *)pdata_buffer->pgo; l0 = 0; lm = more/2;
while (l0 < lm) { while (l0 < lm) {
SUMMER(p0, &peasycap->audio_sample, &peasycap->audio_niveau, \ SUMMER(p0, &peasycap->audio_sample, &peasycap->audio_niveau,
&peasycap->audio_square); l0++; p0 += 2; &peasycap->audio_square); l0++; p0 += 2;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -1779,11 +1779,11 @@ while (fragment == (peasycap->audio_read / \ ...@@ -1779,11 +1779,11 @@ while (fragment == (peasycap->audio_read / \
puserspacebuffer += more; puserspacebuffer += more;
kount -= (size_t)more; kount -= (size_t)more;
} }
JOM(12, "after read, %i=frag read %i=frag fill\n", \ JOM(12, "after read, %i=frag read %i=frag fill\n",
(peasycap->audio_read / peasycap->audio_pages_per_fragment), \ (peasycap->audio_read / peasycap->audio_pages_per_fragment),
(peasycap->audio_fill / peasycap->audio_pages_per_fragment)); (peasycap->audio_fill / peasycap->audio_pages_per_fragment));
if (kount < 0) { if (kount < 0) {
SAM("MISTAKE: %li=kount %li=szret\n", \ SAM("MISTAKE: %li=kount %li=szret\n",
(long int)kount, (long int)szret); (long int)kount, (long int)szret);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -1799,7 +1799,7 @@ if (peasycap->audio_sample) { ...@@ -1799,7 +1799,7 @@ if (peasycap->audio_sample) {
mean = peasycap->audio_niveau; mean = peasycap->audio_niveau;
sdr = signed_div(mean, peasycap->audio_sample); sdr = signed_div(mean, peasycap->audio_sample);
JOM(8, "%8lli=mean %8lli=meansquare after %lli samples, =>\n", \ JOM(8, "%8lli=mean %8lli=meansquare after %lli samples, =>\n",
sdr.quotient, above, peasycap->audio_sample); sdr.quotient, above, peasycap->audio_sample);
sdr = signed_div(above, 32768); sdr = signed_div(above, 32768);
...@@ -1818,9 +1818,9 @@ if (!peasycap->timeval1.tv_sec) { ...@@ -1818,9 +1818,9 @@ if (!peasycap->timeval1.tv_sec) {
sdr.quotient = 192000; sdr.quotient = 192000;
} else { } else {
peasycap->audio_bytes += (long long int) szret; peasycap->audio_bytes += (long long int) szret;
below = ((long long int)(1000000)) * \ below = ((long long int)(1000000)) *
((long long int)(timeval.tv_sec - \ ((long long int)(timeval.tv_sec -
peasycap->timeval3.tv_sec)) + \ peasycap->timeval3.tv_sec)) +
(long long int)(timeval.tv_usec - peasycap->timeval3.tv_usec); (long long int)(timeval.tv_usec - peasycap->timeval3.tv_usec);
above = 1000000 * ((long long int) peasycap->audio_bytes); above = 1000000 * ((long long int) peasycap->audio_bytes);
...@@ -1881,9 +1881,9 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) { ...@@ -1881,9 +1881,9 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device has become NULL\n"); SAM("ERROR: peasycap->pusb_device has become NULL\n");
return -ENODEV; return -ENODEV;
} }
rc = usb_set_interface(peasycap->pusb_device, peasycap->audio_interface, \ rc = usb_set_interface(peasycap->pusb_device, peasycap->audio_interface,
peasycap->audio_altsetting_on); peasycap->audio_altsetting_on);
JOM(8, "usb_set_interface(.,%i,%i) returned %i\n", peasycap->audio_interface, \ JOM(8, "usb_set_interface(.,%i,%i) returned %i\n", peasycap->audio_interface,
peasycap->audio_altsetting_on, rc); peasycap->audio_altsetting_on, rc);
rc = wakeup_device(peasycap->pusb_device); rc = wakeup_device(peasycap->pusb_device);
...@@ -1930,10 +1930,10 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) { ...@@ -1930,10 +1930,10 @@ if ((struct usb_device *)NULL == peasycap->pusb_device) {
if (!peasycap->audio_isoc_streaming) { if (!peasycap->audio_isoc_streaming) {
JOM(4, "initial submission of all audio urbs\n"); JOM(4, "initial submission of all audio urbs\n");
rc = usb_set_interface(peasycap->pusb_device, rc = usb_set_interface(peasycap->pusb_device,
peasycap->audio_interface, \ peasycap->audio_interface,
peasycap->audio_altsetting_on); peasycap->audio_altsetting_on);
JOM(8, "usb_set_interface(.,%i,%i) returned %i\n", \ JOM(8, "usb_set_interface(.,%i,%i) returned %i\n",
peasycap->audio_interface, \ peasycap->audio_interface,
peasycap->audio_altsetting_on, rc); peasycap->audio_altsetting_on, rc);
isbad = 0; nospc = 0; m = 0; isbad = 0; nospc = 0; m = 0;
...@@ -1946,13 +1946,13 @@ if (!peasycap->audio_isoc_streaming) { ...@@ -1946,13 +1946,13 @@ if (!peasycap->audio_isoc_streaming) {
purb->interval = 1; purb->interval = 1;
purb->dev = peasycap->pusb_device; purb->dev = peasycap->pusb_device;
purb->pipe = \ purb->pipe =
usb_rcvisocpipe(peasycap->pusb_device,\ usb_rcvisocpipe(peasycap->pusb_device,
peasycap->audio_endpointnumber); peasycap->audio_endpointnumber);
purb->transfer_flags = URB_ISO_ASAP; purb->transfer_flags = URB_ISO_ASAP;
purb->transfer_buffer = \ purb->transfer_buffer =
peasycap->audio_isoc_buffer[isbuf].pgo; peasycap->audio_isoc_buffer[isbuf].pgo;
purb->transfer_buffer_length = \ purb->transfer_buffer_length =
peasycap->audio_isoc_buffer_size; peasycap->audio_isoc_buffer_size;
#if defined(EASYCAP_NEEDS_ALSA) #if defined(EASYCAP_NEEDS_ALSA)
purb->complete = easycap_alsa_complete; purb->complete = easycap_alsa_complete;
...@@ -1961,23 +1961,23 @@ if (!peasycap->audio_isoc_streaming) { ...@@ -1961,23 +1961,23 @@ if (!peasycap->audio_isoc_streaming) {
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /*EASYCAP_NEEDS_ALSA*/
purb->context = peasycap; purb->context = peasycap;
purb->start_frame = 0; purb->start_frame = 0;
purb->number_of_packets = \ purb->number_of_packets =
peasycap->audio_isoc_framesperdesc; peasycap->audio_isoc_framesperdesc;
for (j = 0; j < peasycap->\ for (j = 0; j < peasycap->
audio_isoc_framesperdesc; \ audio_isoc_framesperdesc;
j++) { j++) {
purb->iso_frame_desc[j].offset = j * \ purb->iso_frame_desc[j].offset = j *
peasycap->\ peasycap->
audio_isoc_maxframesize; audio_isoc_maxframesize;
purb->iso_frame_desc[j].length = \ purb->iso_frame_desc[j].length =
peasycap->\ peasycap->
audio_isoc_maxframesize; audio_isoc_maxframesize;
} }
rc = usb_submit_urb(purb, GFP_KERNEL); rc = usb_submit_urb(purb, GFP_KERNEL);
if (0 != rc) { if (0 != rc) {
isbad++; isbad++;
SAM("ERROR: usb_submit_urb() failed" \ SAM("ERROR: usb_submit_urb() failed"
" for urb with rc:\n"); " for urb with rc:\n");
switch (rc) { switch (rc) {
case -ENODEV: { case -ENODEV: {
...@@ -2047,7 +2047,7 @@ if (!peasycap->audio_isoc_streaming) { ...@@ -2047,7 +2047,7 @@ if (!peasycap->audio_isoc_streaming) {
if (isbad) { if (isbad) {
JOM(4, "attempting cleanup instead of submitting\n"); JOM(4, "attempting cleanup instead of submitting\n");
list_for_each(plist_head, (peasycap->purb_audio_head)) { list_for_each(plist_head, (peasycap->purb_audio_head)) {
pdata_urb = list_entry(plist_head, struct data_urb, \ pdata_urb = list_entry(plist_head, struct data_urb,
list_head); list_head);
if (NULL != pdata_urb) { if (NULL != pdata_urb) {
purb = pdata_urb->purb; purb = pdata_urb->purb;
...@@ -2103,7 +2103,7 @@ if (peasycap->audio_isoc_streaming) { ...@@ -2103,7 +2103,7 @@ if (peasycap->audio_isoc_streaming) {
return -EFAULT; return -EFAULT;
} }
} else { } else {
JOM(8, "%i=audio_isoc_streaming, no audio urbs killed\n", \ JOM(8, "%i=audio_isoc_streaming, no audio urbs killed\n",
peasycap->audio_isoc_streaming); peasycap->audio_isoc_streaming);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment