Unreachable code
File: drivers/staging/easycap/.tmp_easycap_ioctl.o.preproc
Full description: The code is unreachable by any path. Superfluous semicolon, break or return statement.
Importance: 3
Checker: ReachabilityChecker
Trace:
This one is:
False positive index (the lower the better): 0
File contents (this file is distributed under the terms specified in the original file):
1|int adjust_standard(struct easycap *peasycap, v4l2_std_id std_id)
2|{
3|struct easycap_standard const *peasycap_standard;
4|__u16 reg, set;
5|int ir, rc, need, k;
6|unsigned int itwas, isnow;
7|bool resubmit;
8|
9|if (((void *)0) == peasycap) {
10| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
11| return -14;
12|}
13|if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
14| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
15| return -14;
16|}
17|peasycap_standard = &easycap_standard[0];
18|while (0xFFFF != peasycap_standard->mask) {
19| if (std_id == peasycap_standard->v4l2_standard.id)
20| break;
21| peasycap_standard++;
22|}
23|if (0xFFFF == peasycap_standard->mask) {
24| peasycap_standard = &easycap_standard[0];
25| while (0xFFFF != peasycap_standard->mask) {
26| if (std_id & peasycap_standard->v4l2_standard.id)
27| break;
28| peasycap_standard++;
29| }
30|}
31|if (0xFFFF == peasycap_standard->mask) {
32| do { printk("<7>" "easycap::%i%s: " "ERROR: 0x%08X=std_id: standard not found\n", peasycap->isdongle, __func__, (unsigned int)std_id);} while (0)
33| ;
34| return -22;
35|}
36|do { printk("<7>" "easycap::%i%s: " "selected standard: %s\n", peasycap->isdongle, __func__, &(peasycap_standard->v4l2_standard.name[0]));} while (0)
37| ;
38|if (peasycap->standard_offset ==
39| (int)(peasycap_standard - &easycap_standard[0])) {
40| do { printk("<7>" "easycap::%i%s: " "requested standard already in effect\n", peasycap->isdongle, __func__);} while (0);
41| return 0;
42|}
43|peasycap->standard_offset = (int)(peasycap_standard - &easycap_standard[0]);
44|for (k = 0; k < 6; k++) {
45| if (!peasycap->inputset[k].standard_offset_ok) {
46| peasycap->inputset[k].standard_offset =
47| peasycap->standard_offset;
48| }
49|}
50|if ((0 <= peasycap->input) && (6 > peasycap->input)) {
51| peasycap->inputset[peasycap->input].standard_offset =
52| peasycap->standard_offset;
53| peasycap->inputset[peasycap->input].standard_offset_ok = 1;
54|} else
55| do {} while (0);
56|peasycap->fps = peasycap_standard->v4l2_standard.frameperiod.denominator /
57| peasycap_standard->v4l2_standard.frameperiod.numerator;
58|switch (peasycap->fps) {
59|case 6:
60|case 30: {
61| peasycap->ntsc = true;
62| break;
63|}
64|case 5:
65|case 25: {
66| peasycap->ntsc = false;
67| break;
68|}
69|default: {
70| do { printk("<7>" "easycap::%i%s: " "MISTAKE: %i=frames-per-second\n", peasycap->isdongle, __func__, peasycap->fps);} while (0);
71| return -2;
72|}
73|}
74|do {} while (0);
75|if (0x8000 & peasycap_standard->mask) {
76| peasycap->skip = 5;
77| peasycap->usec = 1000000 / (2 * (5 * peasycap->fps));
78| peasycap->tolerate = 1000 * (25 / (5 * peasycap->fps));
79|} else {
80| peasycap->skip = 0;
81| peasycap->usec = 1000000 / (2 * peasycap->fps);
82| peasycap->tolerate = 1000 * (25 / peasycap->fps);
83|}
84|if (peasycap->video_isoc_streaming) {
85| resubmit = true;
86| kill_video_urbs(peasycap);
87|} else
88| resubmit = false;
89|
90|
91|
92|
93|
94|need = 0; itwas = 0; reg = 0x00; set = 0x00;
95|switch (peasycap_standard->mask & 0x000F) {
96|case 5: {
97| reg = 0x0A; set = 0x95;
98| ir = read_saa(peasycap->pusb_device, reg);
99| if (0 > ir)
100| do { printk("<7>" "easycap::%i%s: " "ERROR: cannot read SAA register 0x%02X\n", peasycap->isdongle, __func__, reg);} while (0);
101| else
102| itwas = (unsigned int)ir;
103| rc = write_saa(peasycap->pusb_device, reg, set);
104| if (0 != rc)
105| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to set SAA register " "0x%02X to 0x%02X for JP standard\n", peasycap->isdongle, __func__, reg, set);} while (0)
106| ;
107| else {
108| isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
109| if (0 > ir)
110| do {} while (0)
111| ;
112| else
113| do {} while (0)
114| ;
115| }
116|
117| reg = 0x0B; set = 0x48;
118| ir = read_saa(peasycap->pusb_device, reg);
119| if (0 > ir)
120| do { printk("<7>" "easycap::%i%s: " "ERROR: cannot read SAA register 0x%02X\n", peasycap->isdongle, __func__, reg);} while (0);
121| else
122| itwas = (unsigned int)ir;
123| rc = write_saa(peasycap->pusb_device, reg, set);
124| if (0 != rc)
125| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to set SAA register 0x%02X to 0x%02X " "for JP standard\n", peasycap->isdongle, __func__, reg, set);} while (0)
126| ;
127| else {
128| isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
129| if (0 > ir)
130| do {} while (0)
131| ;
132| else
133| do {} while (0)
134| ;
135| }
136|
137|
138|
139|
140|
141|}
142|case 1:
143|case 0: {
144| reg = 0x0E; set = 0x01; need = 1; break;
145|}
146|case 8:
147|case 7: {
148| reg = 0x0E; set = 0x11; need = 1; break;
149|}
150|case 3:
151|case 2: {
152| reg = 0x0E; set = 0x21; need = 1; break;
153|}
154|case 6:
155|case 9: {
156| reg = 0x0E; set = 0x31; need = 1; break;
157|}
158|case 4: {
159| reg = 0x0E; set = 0x51; need = 1; break;
160|}
161|default:
162| break;
163|}
164|
165|if (need) {
166| ir = read_saa(peasycap->pusb_device, reg);
167| if (0 > ir)
168| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to read SAA register 0x%02X\n", peasycap->isdongle, __func__, reg);} while (0);
169| else
170| itwas = (unsigned int)ir;
171| rc = write_saa(peasycap->pusb_device, reg, set);
172| if (0 != write_saa(peasycap->pusb_device, reg, set)) {
173| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to set SAA register " "0x%02X to 0x%02X for table 42\n", peasycap->isdongle, __func__, reg, set);} while (0)
174| ;
175| } else {
176| isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
177| if (0 > ir)
178| do {} while (0)
179| ;
180| else
181| do {} while (0)
182| ;
183| }
184|}
185|
186|
187|
188|
189|
190|reg = 0x08;
191|ir = read_saa(peasycap->pusb_device, reg);
192|if (0 > ir)
193| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to read SAA register 0x%02X " "so cannot reset\n", peasycap->isdongle, __func__, reg);} while (0)
194| ;
195|else {
196| itwas = (unsigned int)ir;
197| if (peasycap_standard->mask & 0x0001)
198| set = itwas | 0x40 ;
199| else
200| set = itwas & ~0x40 ;
201| rc = write_saa(peasycap->pusb_device, reg, set);
202| if (0 != rc)
203| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to set SAA register 0x%02X to 0x%02X\n", peasycap->isdongle, __func__, reg, set);} while (0)
204| ;
205| else {
206| isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
207| if (0 > ir)
208| do {} while (0)
209| ;
210| else
211| do {} while (0)
212| ;
213| }
214|}
215|
216|
217|
218|
219|
220|reg = 0x40;
221|ir = read_saa(peasycap->pusb_device, reg);
222|if (0 > ir)
223| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to read SAA register 0x%02X " "so cannot reset\n", peasycap->isdongle, __func__, reg);} while (0)
224| ;
225|else {
226| itwas = (unsigned int)ir;
227| if (peasycap_standard->mask & 0x0001)
228| set = itwas | 0x80 ;
229| else
230| set = itwas & ~0x80 ;
231| rc = write_saa(peasycap->pusb_device, reg, set);
232| if (0 != rc)
233| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to set SAA register 0x%02X to 0x%02X\n", peasycap->isdongle, __func__, reg, set);} while (0)
234| ;
235| else {
236| isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
237| if (0 > ir)
238| do {} while (0)
239| ;
240| else
241| do {} while (0)
242| ;
243| }
244|}
245|
246|
247|
248|
249|
250|reg = 0x5A;
251|ir = read_saa(peasycap->pusb_device, reg);
252|if (0 > ir)
253| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to read SAA register 0x%02X but continuing\n", peasycap->isdongle, __func__, reg);} while (0);
254| itwas = (unsigned int)ir;
255| if (peasycap_standard->mask & 0x0001)
256| set = 0x0A ;
257| else
258| set = 0x07 ;
259| if (0 != write_saa(peasycap->pusb_device, reg, set))
260| do { printk("<7>" "easycap::%i%s: " "ERROR: failed to set SAA register 0x%02X to 0x%02X\n", peasycap->isdongle, __func__, reg, set);} while (0)
261| ;
262| else {
263| isnow = (unsigned int)read_saa(peasycap->pusb_device, reg);
264| if (0 > ir)
265| do {} while (0)
266| ;
267| else
268| do {} while (0)
269| ;
270| }
271|if (true == resubmit)
272| submit_video_urbs(peasycap);
273|return 0;
274|}
275|int adjust_format(struct easycap *peasycap,
276| __u32 width, __u32 height, __u32 pixelformat, int field, bool try)
277|{
278|struct easycap_format *peasycap_format, *peasycap_best_format;
279|__u16 mask;
280|struct usb_device *p;
281|int miss, multiplier, best, k;
282|char bf[5], fo[32], *pc;
283|__u32 uc;
284|bool resubmit;
285|
286|if (((void *)0) == peasycap) {
287| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
288| return -14;
289|}
290|if (0 > peasycap->standard_offset) {
291| do {} while (0);
292| return -16;
293|}
294|p = peasycap->pusb_device;
295|if ((struct usb_device *)((void *)0) == p) {
296| do { printk("<7>" "easycap::%i%s: " "ERROR: peaycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
297| return -14;
298|}
299|pc = &bf[0];
300|uc = pixelformat;
301|__st_memcpy_st__((void *)pc, (void *)(&uc), 4);
302|bf[4] = 0;
303|mask = 0xFF & easycap_standard[peasycap->standard_offset].mask;
304|do { printk("<7>" "easycap::%i%s: " "sought: %ix%i,%s(0x%08X),%i=field,0x%02X=std mask\n", peasycap->isdongle, __func__, width, height, pc, pixelformat, field, mask);} while (0)
305| ;
306|switch (field) {
307|case V4L2_FIELD_ANY: {
308| strcpy(&fo[0], "V4L2_FIELD_ANY ");
309| break;
310|}
311|case V4L2_FIELD_NONE: {
312| strcpy(&fo[0], "V4L2_FIELD_NONE");
313| break;
314|}
315|case V4L2_FIELD_TOP: {
316| strcpy(&fo[0], "V4L2_FIELD_TOP");
317| break;
318|}
319|case V4L2_FIELD_BOTTOM: {
320| strcpy(&fo[0], "V4L2_FIELD_BOTTOM");
321| break;
322|}
323|case V4L2_FIELD_INTERLACED: {
324| strcpy(&fo[0], "V4L2_FIELD_INTERLACED");
325| break;
326|}
327|case V4L2_FIELD_SEQ_TB: {
328| strcpy(&fo[0], "V4L2_FIELD_SEQ_TB");
329| break;
330|}
331|case V4L2_FIELD_SEQ_BT: {
332| strcpy(&fo[0], "V4L2_FIELD_SEQ_BT");
333| break;
334|}
335|case V4L2_FIELD_ALTERNATE: {
336| strcpy(&fo[0], "V4L2_FIELD_ALTERNATE");
337| break;
338|}
339|case V4L2_FIELD_INTERLACED_TB: {
340| strcpy(&fo[0], "V4L2_FIELD_INTERLACED_TB");
341| break;
342|}
343|case V4L2_FIELD_INTERLACED_BT: {
344| strcpy(&fo[0], "V4L2_FIELD_INTERLACED_BT");
345| break;
346|}
347|default: {
348| strcpy(&fo[0], "V4L2_FIELD_... UNKNOWN ");
349| break;
350|}
351|}
352|do { printk("<7>" "easycap::%i%s: " "sought: %s\n", peasycap->isdongle, __func__, &fo[0]);} while (0);
353|if (V4L2_FIELD_ANY == field) {
354| field = V4L2_FIELD_NONE;
355| do { printk("<7>" "easycap::%i%s: " "prefer: V4L2_FIELD_NONE=field, was V4L2_FIELD_ANY\n", peasycap->isdongle, __func__);} while (0);
356|}
357|peasycap_best_format = (struct easycap_format *)((void *)0);
358|peasycap_format = &easycap_format[0];
359|while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
360| do {} while (0)
361|
362|
363|
364|
365| ;
366|
367| if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
368| (peasycap_format->v4l2_format.fmt.pix.field == field) &&
369| (peasycap_format->v4l2_format.fmt.pix.pixelformat ==
370| pixelformat) &&
371| (peasycap_format->v4l2_format.fmt.pix.width == width) &&
372| (peasycap_format->v4l2_format.fmt.pix.height == height)) {
373| peasycap_best_format = peasycap_format;
374| break;
375| }
376| peasycap_format++;
377|}
378|if (0 == peasycap_format->v4l2_format.fmt.pix.width) {
379| do { printk("<7>" "easycap::%i%s: " "cannot do: %ix%i with standard mask 0x%02X\n", peasycap->isdongle, __func__, width, height, mask);} while (0)
380| ;
381| peasycap_format = &easycap_format[0]; best = -1;
382| while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
383| if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
384| (peasycap_format->v4l2_format.fmt.pix
385| .field == field) &&
386| (peasycap_format->v4l2_format.fmt.pix
387| .pixelformat == pixelformat)) {
388| miss = ({ long __x = (peasycap_format-> v4l2_format.fmt.pix.width - width); (__x < 0) ? -__x : __x; })
389| ;
390| if ((best > miss) || (best < 0)) {
391| best = miss;
392| peasycap_best_format = peasycap_format;
393| if (!miss)
394| break;
395| }
396| }
397| peasycap_format++;
398| }
399| if (-1 == best) {
400| do { printk("<7>" "easycap::%i%s: " "cannot do %ix... with standard mask 0x%02X\n", peasycap->isdongle, __func__, width, mask);} while (0)
401| ;
402| do { printk("<7>" "easycap::%i%s: " "cannot do ...x%i with standard mask 0x%02X\n", peasycap->isdongle, __func__, height, mask);} while (0)
403| ;
404| do { printk("<7>" "easycap::%i%s: " " %ix%i unmatched\n", peasycap->isdongle, __func__, width, height);} while (0);
405| return peasycap->format_offset;
406| }
407|}
408|if ((struct easycap_format *)((void *)0) == peasycap_best_format) {
409| do { printk("<7>" "easycap::%i%s: " "MISTAKE: peasycap_best_format is NULL", peasycap->isdongle, __func__);} while (0);
410| return -22;
411|}
412|peasycap_format = peasycap_best_format;
413|
414|
415|if (true == try)
416| return (int)(peasycap_best_format - &easycap_format[0]);
417|
418|
419|if (false != try) {
420| do { printk("<7>" "easycap::%i%s: " "MISTAKE: true==try where is should be false\n", peasycap->isdongle, __func__);} while (0);
421| return -22;
422|}
423|do { printk("<7>" "easycap::%i%s: " "actioning: %ix%i %s\n", peasycap->isdongle, __func__, peasycap_format->v4l2_format.fmt.pix.width, peasycap_format->v4l2_format.fmt.pix.height, &peasycap_format->name[0]);} while (0)
424|
425|
426| ;
427|peasycap->height = peasycap_format->v4l2_format.fmt.pix.height;
428|peasycap->width = peasycap_format->v4l2_format.fmt.pix.width;
429|peasycap->pixelformat = peasycap_format->v4l2_format.fmt.pix.pixelformat;
430|peasycap->format_offset = (int)(peasycap_format - &easycap_format[0]);
431|
432|
433|for (k = 0; k < 6; k++) {
434| if (!peasycap->inputset[k].format_offset_ok) {
435| peasycap->inputset[k].format_offset =
436| peasycap->format_offset;
437| }
438|}
439|if ((0 <= peasycap->input) && (6 > peasycap->input)) {
440| peasycap->inputset[peasycap->input].format_offset =
441| peasycap->format_offset;
442| peasycap->inputset[peasycap->input].format_offset_ok = 1;
443|} else
444| do {} while (0);
445|
446|
447|
448|peasycap->bytesperpixel = (0x00E0 & peasycap_format->mask) >> 5 ;
449|if (0x0100 & peasycap_format->mask)
450| peasycap->byteswaporder = true;
451|else
452| peasycap->byteswaporder = false;
453|if (0x0200 & peasycap_format->mask)
454| peasycap->skip = 5;
455|else
456| peasycap->skip = 0;
457|if (0x0800 & peasycap_format->mask)
458| peasycap->decimatepixel = true;
459|else
460| peasycap->decimatepixel = false;
461|if (0x1000 & peasycap_format->mask)
462| peasycap->offerfields = true;
463|else
464| peasycap->offerfields = false;
465|if (true == peasycap->decimatepixel)
466| multiplier = 2;
467|else
468| multiplier = 1;
469|peasycap->videofieldamount = multiplier * peasycap->width *
470| multiplier * peasycap->height;
471|peasycap->frame_buffer_used = peasycap->bytesperpixel *
472| peasycap->width * peasycap->height;
473|if (peasycap->video_isoc_streaming) {
474| resubmit = true;
475| kill_video_urbs(peasycap);
476|} else
477| resubmit = false;
478|
479|
480|
481|
482|
483|if (0 == (0x01 & peasycap_format->mask)) {
484| if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
485| (576 ==
486| peasycap_format->v4l2_format.fmt.pix.height)) ||
487| ((360 ==
488| peasycap_format->v4l2_format.fmt.pix.width) &&
489| (288 ==
490| peasycap_format->v4l2_format.fmt.pix.height))) {
491| if (0 != set_resolution(p, 0x0000, 0x0001, 0x05A0, 0x0121)) {
492| do { printk("<7>" "easycap::%i%s: " "ERROR: set_resolution() failed\n", peasycap->isdongle, __func__);} while (0);
493| return -22;
494| }
495| } else if ((704 == peasycap_format->v4l2_format.fmt.pix.width) &&
496| (576 == peasycap_format->v4l2_format.fmt.pix.height)) {
497| if (0 != set_resolution(p, 0x0004, 0x0001, 0x0584, 0x0121)) {
498| do { printk("<7>" "easycap::%i%s: " "ERROR: set_resolution() failed\n", peasycap->isdongle, __func__);} while (0);
499| return -22;
500| }
501| } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
502| (480 ==
503| peasycap_format->v4l2_format.fmt.pix.height)) ||
504| ((320 ==
505| peasycap_format->v4l2_format.fmt.pix.width) &&
506| (240 ==
507| peasycap_format->v4l2_format.fmt.pix.height))) {
508| if (0 != set_resolution(p, 0x0014, 0x0020, 0x0514, 0x0110)) {
509| do { printk("<7>" "easycap::%i%s: " "ERROR: set_resolution() failed\n", peasycap->isdongle, __func__);} while (0);
510| return -22;
511| }
512| } else {
513| do { printk("<7>" "easycap::%i%s: " "MISTAKE: bad format, cannot set resolution\n", peasycap->isdongle, __func__);} while (0);
514| return -22;
515| }
516|
517|
518|
519|
520|
521|} else {
522| if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
523| (480 ==
524| peasycap_format->v4l2_format.fmt.pix.height)) ||
525| ((360 ==
526| peasycap_format->v4l2_format.fmt.pix.width) &&
527| (240 ==
528| peasycap_format->v4l2_format.fmt.pix.height))) {
529| if (0 != set_resolution(p, 0x0000, 0x0003, 0x05A0, 0x00F3)) {
530| do { printk("<7>" "easycap::%i%s: " "ERROR: set_resolution() failed\n", peasycap->isdongle, __func__);} while (0);
531| return -22;
532| }
533| } else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
534| (480 ==
535| peasycap_format->v4l2_format.fmt.pix.height)) ||
536| ((320 ==
537| peasycap_format->v4l2_format.fmt.pix.width) &&
538| (240 ==
539| peasycap_format->v4l2_format.fmt.pix.height))) {
540| if (0 != set_resolution(p, 0x0014, 0x0003, 0x0514, 0x00F3)) {
541| do { printk("<7>" "easycap::%i%s: " "ERROR: set_resolution() failed\n", peasycap->isdongle, __func__);} while (0);
542| return -22;
543| }
544| } else {
545| do { printk("<7>" "easycap::%i%s: " "MISTAKE: bad format, cannot set resolution\n", peasycap->isdongle, __func__);} while (0);
546| return -22;
547| }
548|}
549|
550|if (true == resubmit)
551| submit_video_urbs(peasycap);
552|return (int)(peasycap_best_format - &easycap_format[0]);
553|}
554|
555|int adjust_brightness(struct easycap *peasycap, int value)
556|{
557|unsigned int mood;
558|int i1, k;
559|
560|if (((void *)0) == peasycap) {
561| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
562| return -14;
563|}
564|if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
565| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
566| return -14;
567|}
568|i1 = 0;
569|while (0xFFFFFFFF != easycap_control[i1].id) {
570| if (((0x00980000 | 0x900)+0) == easycap_control[i1].id) {
571| if ((easycap_control[i1].minimum > value) ||
572| (easycap_control[i1].maximum < value))
573| value = easycap_control[i1].default_value;
574|
575| if ((easycap_control[i1].minimum <= peasycap->brightness) &&
576| (easycap_control[i1].maximum >=
577| peasycap->brightness)) {
578| if (peasycap->brightness == value) {
579| do { printk("<7>" "easycap::%i%s: " "unchanged brightness at 0x%02X\n", peasycap->isdongle, __func__, value);} while (0)
580| ;
581| return 0;
582| }
583| }
584| peasycap->brightness = value;
585| for (k = 0; k < 6; k++) {
586| if (!peasycap->inputset[k].brightness_ok)
587| peasycap->inputset[k].brightness =
588| peasycap->brightness;
589| }
590| if ((0 <= peasycap->input) && (6 > peasycap->input)) {
591| peasycap->inputset[peasycap->input].brightness =
592| peasycap->brightness;
593| peasycap->inputset[peasycap->input].brightness_ok = 1;
594| } else
595| do {} while (0);
596| mood = 0x00FF & (unsigned int)peasycap->brightness;
597| if (!write_saa(peasycap->pusb_device, 0x0A, mood)) {
598| do { printk("<7>" "easycap::%i%s: " "adjusting brightness to 0x%02X\n", peasycap->isdongle, __func__, mood);} while (0);
599| return 0;
600| } else {
601| do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust brightness " "to 0x%02X\n", peasycap->isdongle, __func__, mood);} while (0)
602| ;
603| return -2;
604| }
605| break;
606| }
607| i1++;
608|}
609|do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust brightness: control not found\n", peasycap->isdongle, __func__);} while (0);
610|return -2;
611|}
612|
613|int adjust_contrast(struct easycap *peasycap, int value)
614|{
615|unsigned int mood;
616|int i1, k;
617|
618|if (((void *)0) == peasycap) {
619| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
620| return -14;
621|}
622|if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
623| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
624| return -14;
625|}
626|i1 = 0;
627|while (0xFFFFFFFF != easycap_control[i1].id) {
628| if (((0x00980000 | 0x900)+1) == easycap_control[i1].id) {
629| if ((easycap_control[i1].minimum > value) ||
630| (easycap_control[i1].maximum < value))
631| value = easycap_control[i1].default_value;
632|
633|
634|
635| if ((easycap_control[i1].minimum <= peasycap->contrast) &&
636| (easycap_control[i1].maximum >=
637| peasycap->contrast)) {
638| if (peasycap->contrast == value) {
639| do { printk("<7>" "easycap::%i%s: " "unchanged contrast at 0x%02X\n", peasycap->isdongle, __func__, value);} while (0);
640| return 0;
641| }
642| }
643| peasycap->contrast = value;
644| for (k = 0; k < 6; k++) {
645| if (!peasycap->inputset[k].contrast_ok) {
646| peasycap->inputset[k].contrast =
647| peasycap->contrast;
648| }
649| }
650| if ((0 <= peasycap->input) && (6 > peasycap->input)) {
651| peasycap->inputset[peasycap->input].contrast =
652| peasycap->contrast;
653| peasycap->inputset[peasycap->input].contrast_ok = 1;
654| } else
655| do {} while (0);
656| mood = 0x00FF & (unsigned int) (peasycap->contrast - 128);
657| if (!write_saa(peasycap->pusb_device, 0x0B, mood)) {
658| do { printk("<7>" "easycap::%i%s: " "adjusting contrast to 0x%02X\n", peasycap->isdongle, __func__, mood);} while (0);
659| return 0;
660| } else {
661| do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust contrast to " "0x%02X\n", peasycap->isdongle, __func__, mood);} while (0)
662| ;
663| return -2;
664| }
665| break;
666| }
667| i1++;
668|}
669|do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust contrast: control not found\n", peasycap->isdongle, __func__);} while (0);
670|return -2;
671|}
672|
673|int adjust_saturation(struct easycap *peasycap, int value)
674|{
675|unsigned int mood;
676|int i1, k;
677|
678|if (((void *)0) == peasycap) {
679| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
680| return -14;
681|}
682|if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
683| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
684| return -14;
685|}
686|i1 = 0;
687|while (0xFFFFFFFF != easycap_control[i1].id) {
688| if (((0x00980000 | 0x900)+2) == easycap_control[i1].id) {
689| if ((easycap_control[i1].minimum > value) ||
690| (easycap_control[i1].maximum < value))
691| value = easycap_control[i1].default_value;
692|
693|
694| if ((easycap_control[i1].minimum <= peasycap->saturation) &&
695| (easycap_control[i1].maximum >=
696| peasycap->saturation)) {
697| if (peasycap->saturation == value) {
698| do { printk("<7>" "easycap::%i%s: " "unchanged saturation at 0x%02X\n", peasycap->isdongle, __func__, value);} while (0)
699| ;
700| return 0;
701| }
702| }
703| peasycap->saturation = value;
704| for (k = 0; k < 6; k++) {
705| if (!peasycap->inputset[k].saturation_ok) {
706| peasycap->inputset[k].saturation =
707| peasycap->saturation;
708| }
709| }
710| if ((0 <= peasycap->input) && (6 > peasycap->input)) {
711| peasycap->inputset[peasycap->input].saturation =
712| peasycap->saturation;
713| peasycap->inputset[peasycap->input].saturation_ok = 1;
714| } else
715| do {} while (0);
716| mood = 0x00FF & (unsigned int) (peasycap->saturation - 128);
717| if (!write_saa(peasycap->pusb_device, 0x0C, mood)) {
718| do { printk("<7>" "easycap::%i%s: " "adjusting saturation to 0x%02X\n", peasycap->isdongle, __func__, mood);} while (0);
719| return 0;
720| } else {
721| do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust saturation to " "0x%02X\n", peasycap->isdongle, __func__, mood);} while (0)
722| ;
723| return -2;
724| }
725| break;
726| }
727| i1++;
728|}
729|do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust saturation: control not found\n", peasycap->isdongle, __func__);} while (0);
730|return -2;
731|}
732|
733|int adjust_hue(struct easycap *peasycap, int value)
734|{
735|unsigned int mood;
736|int i1, i2, k;
737|
738|if (((void *)0) == peasycap) {
739| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
740| return -14;
741|}
742|if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
743| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
744| return -14;
745|}
746|i1 = 0;
747|while (0xFFFFFFFF != easycap_control[i1].id) {
748| if (((0x00980000 | 0x900)+3) == easycap_control[i1].id) {
749| if ((easycap_control[i1].minimum > value) ||
750| (easycap_control[i1].maximum < value))
751| value = easycap_control[i1].default_value;
752|
753| if ((easycap_control[i1].minimum <= peasycap->hue) &&
754| (easycap_control[i1].maximum >=
755| peasycap->hue)) {
756| if (peasycap->hue == value) {
757| do { printk("<7>" "easycap::%i%s: " "unchanged hue at 0x%02X\n", peasycap->isdongle, __func__, value);} while (0);
758| return 0;
759| }
760| }
761| peasycap->hue = value;
762| for (k = 0; k < 6; k++) {
763| if (!peasycap->inputset[k].hue_ok)
764| peasycap->inputset[k].hue = peasycap->hue;
765| }
766| if ((0 <= peasycap->input) && (6 > peasycap->input)) {
767| peasycap->inputset[peasycap->input].hue =
768| peasycap->hue;
769| peasycap->inputset[peasycap->input].hue_ok = 1;
770| } else
771| do {} while (0);
772| i2 = peasycap->hue - 128;
773| mood = 0x00FF & ((int) i2);
774| if (!write_saa(peasycap->pusb_device, 0x0D, mood)) {
775| do { printk("<7>" "easycap::%i%s: " "adjusting hue to 0x%02X\n", peasycap->isdongle, __func__, mood);} while (0);
776| return 0;
777| } else {
778| do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust hue to 0x%02X\n", peasycap->isdongle, __func__, mood);} while (0);
779| return -2;
780| }
781| break;
|This node is unreachable prev next
782| }
783| i1++;
784|}
785|do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust hue: control not found\n", peasycap->isdongle, __func__);} while (0);
786|return -2;
787|}
788|
789|int adjust_volume(struct easycap *peasycap, int value)
790|{
791|__s8 mood;
792|int i1;
793|
794|if (((void *)0) == peasycap) {
795| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
796| return -14;
797|}
798|if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
799| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
800| return -14;
801|}
802|i1 = 0;
803|while (0xFFFFFFFF != easycap_control[i1].id) {
804| if (((0x00980000 | 0x900)+5) == easycap_control[i1].id) {
805| if ((easycap_control[i1].minimum > value) ||
806| (easycap_control[i1].maximum < value))
807| value = easycap_control[i1].default_value;
808| if ((easycap_control[i1].minimum <= peasycap->volume) &&
809| (easycap_control[i1].maximum >=
810| peasycap->volume)) {
811| if (peasycap->volume == value) {
812| do { printk("<7>" "easycap::%i%s: " "unchanged volume at 0x%02X\n", peasycap->isdongle, __func__, value);} while (0);
813| return 0;
814| }
815| }
816| peasycap->volume = value;
817| mood = (16 > peasycap->volume) ? 16 :
818| ((31 < peasycap->volume) ? 31 :
819| (__s8) peasycap->volume);
820| if (!audio_gainset(peasycap->pusb_device, mood)) {
821| do { printk("<7>" "easycap::%i%s: " "adjusting volume to 0x%02X\n", peasycap->isdongle, __func__, mood);} while (0);
822| return 0;
823| } else {
824| do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust volume to " "0x%2X\n", peasycap->isdongle, __func__, mood);} while (0)
825| ;
826| return -2;
827| }
828| break;
829| }
830|i1++;
831|}
832|do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust volume: control not found\n", peasycap->isdongle, __func__);} while (0);
833|return -2;
834|}
835|int adjust_mute(struct easycap *peasycap, int value)
836|{
837|int i1;
838|
839|if (((void *)0) == peasycap) {
840| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
841| return -14;
842|}
843|if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
844| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
845| return -14;
846|}
847|i1 = 0;
848|while (0xFFFFFFFF != easycap_control[i1].id) {
849| if (((0x00980000 | 0x900)+9) == easycap_control[i1].id) {
850| peasycap->mute = value;
851| switch (peasycap->mute) {
852| case 1: {
853| peasycap->audio_idle = 1;
854| peasycap->timeval0.tv_sec = 0;
855| do { printk("<7>" "easycap::%i%s: " "adjusting mute: %i=peasycap->audio_idle\n", peasycap->isdongle, __func__, peasycap->audio_idle);} while (0)
856| ;
857| return 0;
858| }
859| default: {
860| peasycap->audio_idle = 0;
861| do { printk("<7>" "easycap::%i%s: " "adjusting mute: %i=peasycap->audio_idle\n", peasycap->isdongle, __func__, peasycap->audio_idle);} while (0)
862| ;
863| return 0;
864| }
865| }
866| break;
867| }
868| i1++;
869|}
870|do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust mute: control not found\n", peasycap->isdongle, __func__);} while (0);
871|return -2;
872|}
873|
874|
875|
876|
877|long
878|easycap_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) {
879| return (long)easycap_ioctl((struct inode *)((void *)0), file, cmd, arg);
880|}
881|
882|
883|
884|int
885|easycap_ioctl(struct inode *inode, struct file *file,
886| unsigned int cmd, unsigned long arg)
887|{
888|struct easycap *peasycap;
889|struct usb_device *p;
890|int kd;
891|
892|if (((void *)0) == file) {
893| do { printk("<7>" "easycap:: %s: " "ERROR: file is NULL\n", __func__); } while (0);
894| return -512;
895|}
896|peasycap = file->private_data;
897|if (((void *)0) == peasycap) {
898| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
899| return -1;
900|}
901|if (memcmp(&peasycap->telltale[0], "expectedstring", strlen("expectedstring"))) {
902| do { printk("<7>" "easycap:: %s: " "ERROR: bad peasycap\n", __func__); } while (0);
903| return -14;
904|}
905|p = peasycap->pusb_device;
906|if (((void *)0) == p) {
907| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
908| return -14;
909|}
910|kd = isdongle(peasycap);
911|if (0 <= kd && 8 > kd) {
912| if (__st_mutex_lock_interruptible_st__(&easycap_dongle[kd].mutex_video)) {
913| do { printk("<7>" "easycap:: %s: " "ERROR: cannot lock easycap_dongle[%i].mutex_video\n", __func__, kd); } while (0);
914| return -512;
915| }
916| do {} while (0);
917|
918|
919|
920|
921|
922|
923|
924| if (kd != isdongle(peasycap))
925| return -512;
926| if (((void *)0) == file) {
927| do { printk("<7>" "easycap:: %s: " "ERROR: file is NULL\n", __func__); } while (0);
928| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
929| return -512;
930| }
931| peasycap = file->private_data;
932| if (((void *)0) == peasycap) {
933| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
934| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
935| return -512;
936| }
937| if (memcmp(&peasycap->telltale[0], "expectedstring", strlen("expectedstring"))) {
938| do { printk("<7>" "easycap:: %s: " "ERROR: bad peasycap\n", __func__); } while (0);
939| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
940| return -14;
941| }
942| p = peasycap->pusb_device;
943| if (((void *)0) == peasycap->pusb_device) {
944| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
945| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
946| return -512;
947| }
948|} else {
949|
950|
951|
952|
953|
954|
955| return -512;
956|}
957|
958|switch (cmd) {
959|case (((2U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((0)) << 0) | (((((sizeof(struct v4l2_capability) == sizeof(struct v4l2_capability[1]) && sizeof(struct v4l2_capability) < (1 << 14)) ? sizeof(struct v4l2_capability) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
960| struct v4l2_capability v4l2_capability;
961| char version[16], *p1, *p2;
962| int i, rc, k[3];
963| long lng;
964|
965| do {} while (0);
966|
967| if (16 <= strlen("0.8.41")) {
968| do { printk("<7>" "easycap::%i%s: " "ERROR: bad driver version string\n", peasycap->isdongle, __func__);} while (0);
969| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
970| return -22;
971| }
972| strcpy(&version[0], "0.8.41");
973| for (i = 0; i < 3; i++)
974| k[i] = 0;
975| p2 = &version[0]; i = 0;
976| while (*p2) {
977| p1 = p2;
978| while (*p2 && ('.' != *p2))
979| p2++;
980| if (*p2)
981| *p2++ = 0;
982| if (3 > i) {
983| rc = (int) strict_strtol(p1, 10, &lng);
984| if (0 != rc) {
985| do { printk("<7>" "easycap::%i%s: " "ERROR: %i=strict_strtol(%s,.,,)\n", peasycap->isdongle, __func__, rc, p1);} while (0)
986| ;
987| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
988| return -22;
989| }
990| k[i] = (int)lng;
991| }
992| i++;
993| }
994|
995| __st_memset_st__(&v4l2_capability, 0, sizeof(struct v4l2_capability));
996| strlcpy(&v4l2_capability.driver[0], "easycap",
997| sizeof(v4l2_capability.driver));
998|
999| v4l2_capability.capabilities =
1000| 0x00000001 | 0x04000000 |
1001| 0x00020000 | 0x01000000;
1002|
1003| v4l2_capability.version = (((k[0]) << 16) + ((k[1]) << 8) + (k[2]));
1004| do {} while (0);
1005|
1006| strlcpy(&v4l2_capability.card[0], "EasyCAP DC60",
1007| sizeof(v4l2_capability.card));
1008|
1009| if (usb_make_path(peasycap->pusb_device, &v4l2_capability.bus_info[0],
1010| sizeof(v4l2_capability.bus_info)) < 0) {
1011| strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info",
1012| sizeof(v4l2_capability.bus_info));
1013| do {} while (0)
1014| ;
1015| }
1016| if (0 != copy_to_user((void *)arg, &v4l2_capability,
1017| sizeof(struct v4l2_capability))) {
1018| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1019| return -14;
1020| }
1021| break;
1022|}
1023|
1024|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((26)) << 0) | (((((sizeof(struct v4l2_input) == sizeof(struct v4l2_input[1]) && sizeof(struct v4l2_input) < (1 << 14)) ? sizeof(struct v4l2_input) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1025| struct v4l2_input v4l2_input;
1026| __u32 index;
1027|
1028| do {} while (0);
1029|
1030| if (0 != copy_from_user(&v4l2_input, (void *)arg,
1031| sizeof(struct v4l2_input))) {
1032| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1033| return -14;
1034| }
1035|
1036| index = v4l2_input.index;
1037| __st_memset_st__(&v4l2_input, 0, sizeof(struct v4l2_input));
1038|
1039| switch (index) {
1040| case 0: {
1041| v4l2_input.index = index;
1042| strcpy(&v4l2_input.name[0], "CVBS0");
1043| v4l2_input.type = 2;
1044| v4l2_input.audioset = 0x01;
1045| v4l2_input.tuner = 0;
1046| v4l2_input.std = ((((v4l2_std_id)0x00000001) | ((v4l2_std_id)0x00000002) | ((v4l2_std_id)0x00000004)) | (((v4l2_std_id)0x00000020) | ((v4l2_std_id)0x00000040) | ((v4l2_std_id)0x00000080)) | ((v4l2_std_id)0x00000008) | ((v4l2_std_id)0x00000010)) | (((v4l2_std_id)0x00010000) | ((v4l2_std_id)0x00040000) | ((v4l2_std_id)0x00080000) | (((v4l2_std_id)0x00020000) | ((v4l2_std_id)0x00100000) | ((v4l2_std_id)0x00200000)) | ((v4l2_std_id)0x00400000) | ((v4l2_std_id)0x00800000)) |
1047| (((v4l2_std_id)0x00001000) | ((v4l2_std_id)0x00002000) | ((v4l2_std_id)0x00008000)) ;
1048| v4l2_input.status = 0;
1049| do {} while (0);
1050| break;
1051| }
1052| case 1: {
1053| v4l2_input.index = index;
1054| strcpy(&v4l2_input.name[0], "CVBS1");
1055| v4l2_input.type = 2;
1056| v4l2_input.audioset = 0x01;
1057| v4l2_input.tuner = 0;
1058| v4l2_input.std = ((((v4l2_std_id)0x00000001) | ((v4l2_std_id)0x00000002) | ((v4l2_std_id)0x00000004)) | (((v4l2_std_id)0x00000020) | ((v4l2_std_id)0x00000040) | ((v4l2_std_id)0x00000080)) | ((v4l2_std_id)0x00000008) | ((v4l2_std_id)0x00000010)) | (((v4l2_std_id)0x00010000) | ((v4l2_std_id)0x00040000) | ((v4l2_std_id)0x00080000) | (((v4l2_std_id)0x00020000) | ((v4l2_std_id)0x00100000) | ((v4l2_std_id)0x00200000)) | ((v4l2_std_id)0x00400000) | ((v4l2_std_id)0x00800000)) |
1059| (((v4l2_std_id)0x00001000) | ((v4l2_std_id)0x00002000) | ((v4l2_std_id)0x00008000)) ;
1060| v4l2_input.status = 0;
1061| do {} while (0);
1062| break;
1063| }
1064| case 2: {
1065| v4l2_input.index = index;
1066| strcpy(&v4l2_input.name[0], "CVBS2");
1067| v4l2_input.type = 2;
1068| v4l2_input.audioset = 0x01;
1069| v4l2_input.tuner = 0;
1070| v4l2_input.std = ((((v4l2_std_id)0x00000001) | ((v4l2_std_id)0x00000002) | ((v4l2_std_id)0x00000004)) | (((v4l2_std_id)0x00000020) | ((v4l2_std_id)0x00000040) | ((v4l2_std_id)0x00000080)) | ((v4l2_std_id)0x00000008) | ((v4l2_std_id)0x00000010)) | (((v4l2_std_id)0x00010000) | ((v4l2_std_id)0x00040000) | ((v4l2_std_id)0x00080000) | (((v4l2_std_id)0x00020000) | ((v4l2_std_id)0x00100000) | ((v4l2_std_id)0x00200000)) | ((v4l2_std_id)0x00400000) | ((v4l2_std_id)0x00800000)) |
1071| (((v4l2_std_id)0x00001000) | ((v4l2_std_id)0x00002000) | ((v4l2_std_id)0x00008000)) ;
1072| v4l2_input.status = 0;
1073| do {} while (0);
1074| break;
1075| }
1076| case 3: {
1077| v4l2_input.index = index;
1078| strcpy(&v4l2_input.name[0], "CVBS3");
1079| v4l2_input.type = 2;
1080| v4l2_input.audioset = 0x01;
1081| v4l2_input.tuner = 0;
1082| v4l2_input.std = ((((v4l2_std_id)0x00000001) | ((v4l2_std_id)0x00000002) | ((v4l2_std_id)0x00000004)) | (((v4l2_std_id)0x00000020) | ((v4l2_std_id)0x00000040) | ((v4l2_std_id)0x00000080)) | ((v4l2_std_id)0x00000008) | ((v4l2_std_id)0x00000010)) | (((v4l2_std_id)0x00010000) | ((v4l2_std_id)0x00040000) | ((v4l2_std_id)0x00080000) | (((v4l2_std_id)0x00020000) | ((v4l2_std_id)0x00100000) | ((v4l2_std_id)0x00200000)) | ((v4l2_std_id)0x00400000) | ((v4l2_std_id)0x00800000)) |
1083| (((v4l2_std_id)0x00001000) | ((v4l2_std_id)0x00002000) | ((v4l2_std_id)0x00008000)) ;
1084| v4l2_input.status = 0;
1085| do {} while (0);
1086| break;
1087| }
1088| case 4: {
1089| v4l2_input.index = index;
1090| strcpy(&v4l2_input.name[0], "CVBS4");
1091| v4l2_input.type = 2;
1092| v4l2_input.audioset = 0x01;
1093| v4l2_input.tuner = 0;
1094| v4l2_input.std = ((((v4l2_std_id)0x00000001) | ((v4l2_std_id)0x00000002) | ((v4l2_std_id)0x00000004)) | (((v4l2_std_id)0x00000020) | ((v4l2_std_id)0x00000040) | ((v4l2_std_id)0x00000080)) | ((v4l2_std_id)0x00000008) | ((v4l2_std_id)0x00000010)) | (((v4l2_std_id)0x00010000) | ((v4l2_std_id)0x00040000) | ((v4l2_std_id)0x00080000) | (((v4l2_std_id)0x00020000) | ((v4l2_std_id)0x00100000) | ((v4l2_std_id)0x00200000)) | ((v4l2_std_id)0x00400000) | ((v4l2_std_id)0x00800000)) |
1095| (((v4l2_std_id)0x00001000) | ((v4l2_std_id)0x00002000) | ((v4l2_std_id)0x00008000)) ;
1096| v4l2_input.status = 0;
1097| do {} while (0);
1098| break;
1099| }
1100| case 5: {
1101| v4l2_input.index = index;
1102| strcpy(&v4l2_input.name[0], "S-VIDEO");
1103| v4l2_input.type = 2;
1104| v4l2_input.audioset = 0x01;
1105| v4l2_input.tuner = 0;
1106| v4l2_input.std = ((((v4l2_std_id)0x00000001) | ((v4l2_std_id)0x00000002) | ((v4l2_std_id)0x00000004)) | (((v4l2_std_id)0x00000020) | ((v4l2_std_id)0x00000040) | ((v4l2_std_id)0x00000080)) | ((v4l2_std_id)0x00000008) | ((v4l2_std_id)0x00000010)) | (((v4l2_std_id)0x00010000) | ((v4l2_std_id)0x00040000) | ((v4l2_std_id)0x00080000) | (((v4l2_std_id)0x00020000) | ((v4l2_std_id)0x00100000) | ((v4l2_std_id)0x00200000)) | ((v4l2_std_id)0x00400000) | ((v4l2_std_id)0x00800000)) |
1107| (((v4l2_std_id)0x00001000) | ((v4l2_std_id)0x00002000) | ((v4l2_std_id)0x00008000)) ;
1108| v4l2_input.status = 0;
1109| do {} while (0);
1110| break;
1111| }
1112| default: {
1113| do {} while (0);
1114| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1115| return -22;
1116| }
1117| }
1118|
1119| if (0 != copy_to_user((void *)arg, &v4l2_input,
1120| sizeof(struct v4l2_input))) {
1121| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1122| return -14;
1123| }
1124| break;
1125|}
1126|
1127|case (((2U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((38)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1128| __u32 index;
1129|
1130| do {} while (0);
1131| index = (__u32)peasycap->input;
1132| do {} while (0);
1133| if (0 != copy_to_user((void *)arg, &index, sizeof(__u32))) {
1134| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1135| return -14;
1136| }
1137| break;
1138|}
1139|
1140|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((39)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
1141| {
1142| __u32 index;
1143| int rc;
1144|
1145| do {} while (0);
1146|
1147| if (0 != copy_from_user(&index, (void *)arg, sizeof(__u32))) {
1148| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1149| return -14;
1150| }
1151|
1152| do {} while (0);
1153|
1154| if ((int)index == peasycap->input) {
1155| do { printk("<7>" "easycap::%i%s: " "requested input already in effect\n", peasycap->isdongle, __func__);} while (0);
1156| break;
1157| }
1158|
1159| if ((0 > index) || (6 <= index)) {
1160| do {} while (0);
1161| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1162| return -22;
1163| }
1164|
1165| rc = newinput(peasycap, (int)index);
1166| if (0 == rc) {
1167| do {} while (0);
1168| } else {
1169| do { printk("<7>" "easycap::%i%s: " "ERROR: newinput(.,%i) returned %i\n", peasycap->isdongle, __func__, (int)index, rc);} while (0);
1170| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1171| return -14;
1172| }
1173| break;
1174|}
1175|
1176|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((65)) << 0) | (((((sizeof(struct v4l2_audio) == sizeof(struct v4l2_audio[1]) && sizeof(struct v4l2_audio) < (1 << 14)) ? sizeof(struct v4l2_audio) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1177| do {} while (0);
1178| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1179| return -22;
1180|}
1181|
1182|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((66)) << 0) | (((((sizeof(struct v4l2_audioout) == sizeof(struct v4l2_audioout[1]) && sizeof(struct v4l2_audioout) < (1 << 14)) ? sizeof(struct v4l2_audioout) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1183| struct v4l2_audioout v4l2_audioout;
1184|
1185| do {} while (0);
1186|
1187| if (0 != copy_from_user(&v4l2_audioout, (void *)arg,
1188| sizeof(struct v4l2_audioout))) {
1189| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1190| return -14;
1191| }
1192|
1193| if (0 != v4l2_audioout.index) {
1194| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1195| return -22;
1196| }
1197| __st_memset_st__(&v4l2_audioout, 0, sizeof(struct v4l2_audioout));
1198| v4l2_audioout.index = 0;
1199| strcpy(&v4l2_audioout.name[0], "Soundtrack");
1200|
1201| if (0 != copy_to_user((void *)arg, &v4l2_audioout,
1202| sizeof(struct v4l2_audioout))) {
1203| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1204| return -14;
1205| }
1206| break;
1207|}
1208|
1209|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((36)) << 0) | (((((sizeof(struct v4l2_queryctrl) == sizeof(struct v4l2_queryctrl[1]) && sizeof(struct v4l2_queryctrl) < (1 << 14)) ? sizeof(struct v4l2_queryctrl) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1210| int i1;
1211| struct v4l2_queryctrl v4l2_queryctrl;
1212|
1213| do {} while (0);
1214|
1215| if (0 != copy_from_user(&v4l2_queryctrl, (void *)arg,
1216| sizeof(struct v4l2_queryctrl))) {
1217| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1218| return -14;
1219| }
1220|
1221| i1 = 0;
1222| while (0xFFFFFFFF != easycap_control[i1].id) {
1223| if (easycap_control[i1].id == v4l2_queryctrl.id) {
1224| do {} while (0)
1225| ;
1226| __st_memcpy_st__(&v4l2_queryctrl, &easycap_control[i1],
1227| sizeof(struct v4l2_queryctrl));
1228| break;
1229| }
1230| i1++;
1231| }
1232| if (0xFFFFFFFF == easycap_control[i1].id) {
1233| do {} while (0);
1234| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1235| return -22;
1236| }
1237| if (0 != copy_to_user((void *)arg, &v4l2_queryctrl,
1238| sizeof(struct v4l2_queryctrl))) {
1239| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1240| return -14;
1241| }
1242| break;
1243|}
1244|
1245|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((37)) << 0) | (((((sizeof(struct v4l2_querymenu) == sizeof(struct v4l2_querymenu[1]) && sizeof(struct v4l2_querymenu) < (1 << 14)) ? sizeof(struct v4l2_querymenu) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1246| do {} while (0);
1247| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1248| return -22;
1249|}
1250|
1251|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((27)) << 0) | (((((sizeof(struct v4l2_control) == sizeof(struct v4l2_control[1]) && sizeof(struct v4l2_control) < (1 << 14)) ? sizeof(struct v4l2_control) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1252| struct v4l2_control *pv4l2_control;
1253|
1254| do {} while (0);
1255| pv4l2_control = kzalloc(sizeof(struct v4l2_control), __st_GFP_KERNEL_st__);
1256| if (!pv4l2_control) {
1257| do { printk("<7>" "easycap::%i%s: " "ERROR: out of memory\n", peasycap->isdongle, __func__);} while (0);
1258| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1259| return -12;
1260| }
1261| if (0 != copy_from_user(pv4l2_control, (void *)arg,
1262| sizeof(struct v4l2_control))) {
1263| kfree(pv4l2_control);
1264| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1265| return -14;
1266| }
1267|
1268| switch (pv4l2_control->id) {
1269| case ((0x00980000 | 0x900)+0): {
1270| pv4l2_control->value = peasycap->brightness;
1271| do {} while (0);
1272| break;
1273| }
1274| case ((0x00980000 | 0x900)+1): {
1275| pv4l2_control->value = peasycap->contrast;
1276| do {} while (0);
1277| break;
1278| }
1279| case ((0x00980000 | 0x900)+2): {
1280| pv4l2_control->value = peasycap->saturation;
1281| do {} while (0);
1282| break;
1283| }
1284| case ((0x00980000 | 0x900)+3): {
1285| pv4l2_control->value = peasycap->hue;
1286| do {} while (0);
1287| break;
1288| }
1289| case ((0x00980000 | 0x900)+5): {
1290| pv4l2_control->value = peasycap->volume;
1291| do {} while (0);
1292| break;
1293| }
1294| case ((0x00980000 | 0x900)+9): {
1295| if (1 == peasycap->mute)
1296| pv4l2_control->value = true;
1297| else
1298| pv4l2_control->value = false;
1299| do {} while (0);
1300| break;
1301| }
1302| default: {
1303| do { printk("<7>" "easycap::%i%s: " "ERROR: unknown V4L2 control: 0x%08X=id\n", peasycap->isdongle, __func__, pv4l2_control->id);} while (0)
1304| ;
1305| kfree(pv4l2_control);
1306| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1307| return -22;
1308| }
1309| }
1310| if (0 != copy_to_user((void *)arg, pv4l2_control,
1311| sizeof(struct v4l2_control))) {
1312| kfree(pv4l2_control);
1313| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1314| return -14;
1315| }
1316| kfree(pv4l2_control);
1317| break;
1318|}
1319|
1320|
1321|
1322|
1323|
1324|
1325|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((28)) << 0) | (((((sizeof(struct v4l2_control) == sizeof(struct v4l2_control[1]) && sizeof(struct v4l2_control) < (1 << 14)) ? sizeof(struct v4l2_control) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
1326| {
1327| struct v4l2_control v4l2_control;
1328|
1329| do {} while (0);
1330|
1331| if (0 != copy_from_user(&v4l2_control, (void *)arg,
1332| sizeof(struct v4l2_control))) {
1333| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1334| return -14;
1335| }
1336|
1337| switch (v4l2_control.id) {
1338| case ((0x00980000 | 0x900)+0): {
1339| do {} while (0);
1340| if (0 != adjust_brightness(peasycap, v4l2_control.value))
1341| ;
1342| break;
1343| }
1344| case ((0x00980000 | 0x900)+1): {
1345| do {} while (0);
1346| if (0 != adjust_contrast(peasycap, v4l2_control.value))
1347| ;
1348| break;
1349| }
1350| case ((0x00980000 | 0x900)+2): {
1351| do {} while (0);
1352| if (0 != adjust_saturation(peasycap, v4l2_control.value))
1353| ;
1354| break;
1355| }
1356| case ((0x00980000 | 0x900)+3): {
1357| do {} while (0);
1358| if (0 != adjust_hue(peasycap, v4l2_control.value))
1359| ;
1360| break;
1361| }
1362| case ((0x00980000 | 0x900)+5): {
1363| do {} while (0);
1364| if (0 != adjust_volume(peasycap, v4l2_control.value))
1365| ;
1366| break;
1367| }
1368| case ((0x00980000 | 0x900)+9): {
1369| int mute;
1370|
1371| do {} while (0);
1372| if (true == v4l2_control.value)
1373| mute = 1;
1374| else
1375| mute = 0;
1376|
1377| if (0 != adjust_mute(peasycap, mute))
1378| do { printk("<7>" "easycap::%i%s: " "WARNING: failed to adjust mute to %i\n", peasycap->isdongle, __func__, mute);} while (0);
1379| break;
1380| }
1381| default: {
1382| do { printk("<7>" "easycap::%i%s: " "ERROR: unknown V4L2 control: 0x%08X=id\n", peasycap->isdongle, __func__, v4l2_control.id);} while (0)
1383| ;
1384| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1385| return -22;
1386| }
1387| }
1388| break;
1389|}
1390|
1391|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((72)) << 0) | (((((sizeof(struct v4l2_ext_controls) == sizeof(struct v4l2_ext_controls[1]) && sizeof(struct v4l2_ext_controls) < (1 << 14)) ? sizeof(struct v4l2_ext_controls) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1392| do {} while (0);
1393| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1394| return -22;
1395|}
1396|
1397|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((2)) << 0) | (((((sizeof(struct v4l2_fmtdesc) == sizeof(struct v4l2_fmtdesc[1]) && sizeof(struct v4l2_fmtdesc) < (1 << 14)) ? sizeof(struct v4l2_fmtdesc) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1398| __u32 index;
1399| struct v4l2_fmtdesc v4l2_fmtdesc;
1400|
1401| do {} while (0);
1402|
1403| if (0 != copy_from_user(&v4l2_fmtdesc, (void *)arg,
1404| sizeof(struct v4l2_fmtdesc))) {
1405| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1406| return -14;
1407| }
1408|
1409| index = v4l2_fmtdesc.index;
1410| __st_memset_st__(&v4l2_fmtdesc, 0, sizeof(struct v4l2_fmtdesc));
1411|
1412| v4l2_fmtdesc.index = index;
1413| v4l2_fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1414|
1415| switch (index) {
1416| case 0: {
1417| v4l2_fmtdesc.flags = 0;
1418| strcpy(&v4l2_fmtdesc.description[0], "uyvy");
1419| v4l2_fmtdesc.pixelformat = ((__u32)('U') | ((__u32)('Y') << 8) | ((__u32)('V') << 16) | ((__u32)('Y') << 24));
1420| do {} while (0);
1421| break;
1422| }
1423| case 1: {
1424| v4l2_fmtdesc.flags = 0;
1425| strcpy(&v4l2_fmtdesc.description[0], "yuy2");
1426| v4l2_fmtdesc.pixelformat = ((__u32)('Y') | ((__u32)('U') << 8) | ((__u32)('Y') << 16) | ((__u32)('V') << 24));
1427| do {} while (0);
1428| break;
1429| }
1430| case 2: {
1431| v4l2_fmtdesc.flags = 0;
1432| strcpy(&v4l2_fmtdesc.description[0], "rgb24");
1433| v4l2_fmtdesc.pixelformat = ((__u32)('R') | ((__u32)('G') << 8) | ((__u32)('B') << 16) | ((__u32)('3') << 24));
1434| do {} while (0);
1435| break;
1436| }
1437| case 3: {
1438| v4l2_fmtdesc.flags = 0;
1439| strcpy(&v4l2_fmtdesc.description[0], "rgb32");
1440| v4l2_fmtdesc.pixelformat = ((__u32)('R') | ((__u32)('G') << 8) | ((__u32)('B') << 16) | ((__u32)('4') << 24));
1441| do {} while (0);
1442| break;
1443| }
1444| case 4: {
1445| v4l2_fmtdesc.flags = 0;
1446| strcpy(&v4l2_fmtdesc.description[0], "bgr24");
1447| v4l2_fmtdesc.pixelformat = ((__u32)('B') | ((__u32)('G') << 8) | ((__u32)('R') << 16) | ((__u32)('3') << 24));
1448| do {} while (0);
1449| break;
1450| }
1451| case 5: {
1452| v4l2_fmtdesc.flags = 0;
1453| strcpy(&v4l2_fmtdesc.description[0], "bgr32");
1454| v4l2_fmtdesc.pixelformat = ((__u32)('B') | ((__u32)('G') << 8) | ((__u32)('R') << 16) | ((__u32)('4') << 24));
1455| do {} while (0);
1456| break;
1457| }
1458| default: {
1459| do {} while (0);
1460| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1461| return -22;
1462| }
1463| }
1464| if (0 != copy_to_user((void *)arg, &v4l2_fmtdesc,
1465| sizeof(struct v4l2_fmtdesc))) {
1466| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1467| return -14;
1468| }
1469| break;
1470|}
1471|
1472|
1473|
1474|
1475|
1476|
1477|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((74)) << 0) | (((((sizeof(struct v4l2_frmsizeenum) == sizeof(struct v4l2_frmsizeenum[1]) && sizeof(struct v4l2_frmsizeenum) < (1 << 14)) ? sizeof(struct v4l2_frmsizeenum) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1478| __u32 index;
1479| struct v4l2_frmsizeenum v4l2_frmsizeenum;
1480|
1481| do {} while (0);
1482|
1483| if (0 != copy_from_user(&v4l2_frmsizeenum, (void *)arg,
1484| sizeof(struct v4l2_frmsizeenum))) {
1485| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1486| return -14;
1487| }
1488|
1489| index = v4l2_frmsizeenum.index;
1490|
1491| v4l2_frmsizeenum.type = (__u32) V4L2_FRMSIZE_TYPE_DISCRETE;
1492|
1493| if (true == peasycap->ntsc) {
1494| switch (index) {
1495| case 0: {
1496| v4l2_frmsizeenum.discrete.width = 640;
1497| v4l2_frmsizeenum.discrete.height = 480;
1498| do {} while (0)
1499|
1500|
1501|
1502| ;
1503| break;
1504| }
1505| case 1: {
1506| v4l2_frmsizeenum.discrete.width = 320;
1507| v4l2_frmsizeenum.discrete.height = 240;
1508| do {} while (0)
1509|
1510|
1511|
1512| ;
1513| break;
1514| }
1515| case 2: {
1516| v4l2_frmsizeenum.discrete.width = 720;
1517| v4l2_frmsizeenum.discrete.height = 480;
1518| do {} while (0)
1519|
1520|
1521|
1522| ;
1523| break;
1524| }
1525| case 3: {
1526| v4l2_frmsizeenum.discrete.width = 360;
1527| v4l2_frmsizeenum.discrete.height = 240;
1528| do {} while (0)
1529|
1530|
1531|
1532| ;
1533| break;
1534| }
1535| default: {
1536| do {} while (0);
1537| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1538| return -22;
1539| }
1540| }
1541| } else {
1542| switch (index) {
1543| case 0: {
1544| v4l2_frmsizeenum.discrete.width = 640;
1545| v4l2_frmsizeenum.discrete.height = 480;
1546| do {} while (0)
1547|
1548|
1549|
1550| ;
1551| break;
1552| }
1553| case 1: {
1554| v4l2_frmsizeenum.discrete.width = 320;
1555| v4l2_frmsizeenum.discrete.height = 240;
1556| do {} while (0)
1557|
1558|
1559|
1560| ;
1561| break;
1562| }
1563| case 2: {
1564| v4l2_frmsizeenum.discrete.width = 704;
1565| v4l2_frmsizeenum.discrete.height = 576;
1566| do {} while (0)
1567|
1568|
1569|
1570| ;
1571| break;
1572| }
1573| case 3: {
1574| v4l2_frmsizeenum.discrete.width = 720;
1575| v4l2_frmsizeenum.discrete.height = 576;
1576| do {} while (0)
1577|
1578|
1579|
1580| ;
1581| break;
1582| }
1583| case 4: {
1584| v4l2_frmsizeenum.discrete.width = 360;
1585| v4l2_frmsizeenum.discrete.height = 288;
1586| do {} while (0)
1587|
1588|
1589|
1590| ;
1591| break;
1592| }
1593| default: {
1594| do {} while (0);
1595| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1596| return -22;
1597| }
1598| }
1599| }
1600| if (0 != copy_to_user((void *)arg, &v4l2_frmsizeenum,
1601| sizeof(struct v4l2_frmsizeenum))) {
1602| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1603| return -14;
1604| }
1605| break;
1606|}
1607|
1608|
1609|
1610|
1611|
1612|
1613|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((75)) << 0) | (((((sizeof(struct v4l2_frmivalenum) == sizeof(struct v4l2_frmivalenum[1]) && sizeof(struct v4l2_frmivalenum) < (1 << 14)) ? sizeof(struct v4l2_frmivalenum) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1614| __u32 index;
1615| int denominator;
1616| struct v4l2_frmivalenum v4l2_frmivalenum;
1617|
1618| do {} while (0);
1619|
1620| if (peasycap->fps)
1621| denominator = peasycap->fps;
1622| else {
1623| if (true == peasycap->ntsc)
1624| denominator = 30;
1625| else
1626| denominator = 25;
1627| }
1628|
1629| if (0 != copy_from_user(&v4l2_frmivalenum, (void *)arg,
1630| sizeof(struct v4l2_frmivalenum))) {
1631| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1632| return -14;
1633| }
1634|
1635| index = v4l2_frmivalenum.index;
1636|
1637| v4l2_frmivalenum.type = (__u32) V4L2_FRMIVAL_TYPE_DISCRETE;
1638|
1639| switch (index) {
1640| case 0: {
1641| v4l2_frmivalenum.discrete.numerator = 1;
1642| v4l2_frmivalenum.discrete.denominator = denominator;
1643| do {} while (0)
1644|
1645| ;
1646| break;
1647| }
1648| case 1: {
1649| v4l2_frmivalenum.discrete.numerator = 1;
1650| v4l2_frmivalenum.discrete.denominator = denominator/5;
1651| do {} while (0)
1652|
1653| ;
1654| break;
1655| }
1656| default: {
1657| do {} while (0);
1658| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1659| return -22;
1660| }
1661| }
1662| if (0 != copy_to_user((void *)arg, &v4l2_frmivalenum,
1663| sizeof(struct v4l2_frmivalenum))) {
1664| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1665| return -14;
1666| }
1667| break;
1668|}
1669|
1670|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((4)) << 0) | (((((sizeof(struct v4l2_format) == sizeof(struct v4l2_format[1]) && sizeof(struct v4l2_format) < (1 << 14)) ? sizeof(struct v4l2_format) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1671| struct v4l2_format *pv4l2_format;
1672| struct v4l2_pix_format *pv4l2_pix_format;
1673|
1674| do {} while (0);
1675| pv4l2_format = kzalloc(sizeof(struct v4l2_format), __st_GFP_KERNEL_st__);
1676| if (!pv4l2_format) {
1677| do { printk("<7>" "easycap::%i%s: " "ERROR: out of memory\n", peasycap->isdongle, __func__);} while (0);
1678| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1679| return -12;
1680| }
1681| pv4l2_pix_format = kzalloc(sizeof(struct v4l2_pix_format), __st_GFP_KERNEL_st__);
1682| if (!pv4l2_pix_format) {
1683| do { printk("<7>" "easycap::%i%s: " "ERROR: out of memory\n", peasycap->isdongle, __func__);} while (0);
1684| kfree(pv4l2_format);
1685| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1686| return -12;
1687| }
1688| if (0 != copy_from_user(pv4l2_format, (void *)arg,
1689| sizeof(struct v4l2_format))) {
1690| kfree(pv4l2_format);
1691| kfree(pv4l2_pix_format);
1692| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1693| return -14;
1694| }
1695|
1696| if (pv4l2_format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
1697| kfree(pv4l2_format);
1698| kfree(pv4l2_pix_format);
1699| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1700| return -22;
1701| }
1702|
1703| __st_memset_st__(pv4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
1704| pv4l2_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1705| __st_memcpy_st__(&pv4l2_format->fmt.pix,
1706| &easycap_format[peasycap->format_offset]
1707| .v4l2_format.fmt.pix, sizeof(struct v4l2_pix_format));
1708| do {} while (0)
1709| ;
1710|
1711| if (0 != copy_to_user((void *)arg, pv4l2_format,
1712| sizeof(struct v4l2_format))) {
1713| kfree(pv4l2_format);
1714| kfree(pv4l2_pix_format);
1715| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1716| return -14;
1717| }
1718| kfree(pv4l2_format);
1719| kfree(pv4l2_pix_format);
1720| break;
1721|}
1722|
1723|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((64)) << 0) | (((((sizeof(struct v4l2_format) == sizeof(struct v4l2_format[1]) && sizeof(struct v4l2_format) < (1 << 14)) ? sizeof(struct v4l2_format) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
1724|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((5)) << 0) | (((((sizeof(struct v4l2_format) == sizeof(struct v4l2_format[1]) && sizeof(struct v4l2_format) < (1 << 14)) ? sizeof(struct v4l2_format) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1725| struct v4l2_format v4l2_format;
1726| struct v4l2_pix_format v4l2_pix_format;
1727| bool try;
1728| int best_format;
1729|
1730| if ((((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((64)) << 0) | (((((sizeof(struct v4l2_format) == sizeof(struct v4l2_format[1]) && sizeof(struct v4l2_format) < (1 << 14)) ? sizeof(struct v4l2_format) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))) == cmd) {
1731| do {} while (0);
1732| try = true;
1733| } else {
1734| do {} while (0);
1735| try = false;
1736| }
1737|
1738| if (0 != copy_from_user(&v4l2_format, (void *)arg,
1739| sizeof(struct v4l2_format))) {
1740| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1741| return -14;
1742| }
1743|
1744| best_format = adjust_format(peasycap,
1745| v4l2_format.fmt.pix.width,
1746| v4l2_format.fmt.pix.height,
1747| v4l2_format.fmt.pix.pixelformat,
1748| v4l2_format.fmt.pix.field,
1749| try);
1750| if (0 > best_format) {
1751| if (-16 == best_format) {
1752| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1753| return -16;
1754| }
1755| do {} while (0);
1756| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1757| return -2;
1758| }
1759|
1760| __st_memset_st__(&v4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
1761| v4l2_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1762|
1763| __st_memcpy_st__(&(v4l2_format.fmt.pix), &(easycap_format[best_format]
1764| .v4l2_format.fmt.pix), sizeof(v4l2_pix_format));
1765| do {} while (0);
1766|
1767| if (0 != copy_to_user((void *)arg, &v4l2_format,
1768| sizeof(struct v4l2_format))) {
1769| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1770| return -14;
1771| }
1772| break;
1773|}
1774|
1775|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((58)) << 0) | (((((sizeof(struct v4l2_cropcap) == sizeof(struct v4l2_cropcap[1]) && sizeof(struct v4l2_cropcap) < (1 << 14)) ? sizeof(struct v4l2_cropcap) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1776| struct v4l2_cropcap v4l2_cropcap;
1777|
1778| do {} while (0);
1779|
1780| if (0 != copy_from_user(&v4l2_cropcap, (void *)arg,
1781| sizeof(struct v4l2_cropcap))) {
1782| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1783| return -14;
1784| }
1785|
1786| if (v4l2_cropcap.type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1787| do {} while (0);
1788|
1789| __st_memset_st__(&v4l2_cropcap, 0, sizeof(struct v4l2_cropcap));
1790| v4l2_cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1791| v4l2_cropcap.bounds.left = 0;
1792| v4l2_cropcap.bounds.top = 0;
1793| v4l2_cropcap.bounds.width = peasycap->width;
1794| v4l2_cropcap.bounds.height = peasycap->height;
1795| v4l2_cropcap.defrect.left = 0;
1796| v4l2_cropcap.defrect.top = 0;
1797| v4l2_cropcap.defrect.width = peasycap->width;
1798| v4l2_cropcap.defrect.height = peasycap->height;
1799| v4l2_cropcap.pixelaspect.numerator = 1;
1800| v4l2_cropcap.pixelaspect.denominator = 1;
1801|
1802| do {} while (0);
1803|
1804| if (0 != copy_to_user((void *)arg, &v4l2_cropcap,
1805| sizeof(struct v4l2_cropcap))) {
1806| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1807| return -14;
1808| }
1809| break;
1810|}
1811|
1812|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((59)) << 0) | (((((sizeof(struct v4l2_crop) == sizeof(struct v4l2_crop[1]) && sizeof(struct v4l2_crop) < (1 << 14)) ? sizeof(struct v4l2_crop) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
1813|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((60)) << 0) | (((((sizeof(struct v4l2_crop) == sizeof(struct v4l2_crop[1]) && sizeof(struct v4l2_crop) < (1 << 14)) ? sizeof(struct v4l2_crop) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1814| do {} while (0);
1815| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1816| return -22;
1817|}
1818|
1819|case (((2U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((63)) << 0) | (((((sizeof(v4l2_std_id) == sizeof(v4l2_std_id[1]) && sizeof(v4l2_std_id) < (1 << 14)) ? sizeof(v4l2_std_id) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1820| do {} while (0)
1821| ;
1822| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1823| return -22;
1824| break;
1825|}
1826|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((25)) << 0) | (((((sizeof(struct v4l2_standard) == sizeof(struct v4l2_standard[1]) && sizeof(struct v4l2_standard) < (1 << 14)) ? sizeof(struct v4l2_standard) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1827| int last0 = -1, last1 = -1, last2 = -1, last3 = -1;
1828| struct v4l2_standard v4l2_standard;
1829| __u32 index;
1830| struct easycap_standard const *peasycap_standard;
1831|
1832| do {} while (0);
1833|
1834| if (0 != copy_from_user(&v4l2_standard, (void *)arg,
1835| sizeof(struct v4l2_standard))) {
1836| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1837| return -14;
1838| }
1839| index = v4l2_standard.index;
1840|
1841| last3 = last2; last2 = last1; last1 = last0; last0 = index;
1842| if ((index == last3) && (index == last2) &&
1843| (index == last1) && (index == last0)) {
1844| index++;
1845| last3 = last2; last2 = last1; last1 = last0; last0 = index;
1846| }
1847|
1848| __st_memset_st__(&v4l2_standard, 0, sizeof(struct v4l2_standard));
1849|
1850| peasycap_standard = &easycap_standard[0];
1851| while (0xFFFF != peasycap_standard->mask) {
1852| if ((int)(peasycap_standard - &easycap_standard[0]) == index)
1853| break;
1854| peasycap_standard++;
1855| }
1856| if (0xFFFF == peasycap_standard->mask) {
1857| do {} while (0);
1858| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1859| return -22;
1860| }
1861| do {} while (0)
1862| ;
1863| __st_memcpy_st__(&v4l2_standard, &(peasycap_standard->v4l2_standard),
1864| sizeof(struct v4l2_standard));
1865|
1866| v4l2_standard.index = index;
1867|
1868| if (0 != copy_to_user((void *)arg, &v4l2_standard,
1869| sizeof(struct v4l2_standard))) {
1870| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1871| return -14;
1872| }
1873| break;
1874|}
1875|
1876|case (((2U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((23)) << 0) | (((((sizeof(v4l2_std_id) == sizeof(v4l2_std_id[1]) && sizeof(v4l2_std_id) < (1 << 14)) ? sizeof(v4l2_std_id) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1877| v4l2_std_id std_id;
1878| struct easycap_standard const *peasycap_standard;
1879|
1880| do {} while (0);
1881|
1882| if (0 > peasycap->standard_offset) {
1883| do {} while (0)
1884| ;
1885| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1886| return -16;
1887| }
1888|
1889| if (0 != copy_from_user(&std_id, (void *)arg,
1890| sizeof(v4l2_std_id))) {
1891| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1892| return -14;
1893| }
1894|
1895| peasycap_standard = &easycap_standard[peasycap->standard_offset];
1896| std_id = peasycap_standard->v4l2_standard.id;
1897|
1898| do {} while (0)
1899| ;
1900|
1901| if (0 != copy_to_user((void *)arg, &std_id,
1902| sizeof(v4l2_std_id))) {
1903| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1904| return -14;
1905| }
1906| break;
1907|}
1908|
1909|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((24)) << 0) | (((((sizeof(v4l2_std_id) == sizeof(v4l2_std_id[1]) && sizeof(v4l2_std_id) < (1 << 14)) ? sizeof(v4l2_std_id) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1910| v4l2_std_id std_id;
1911| int rc;
1912|
1913| do {} while (0);
1914|
1915| if (0 != copy_from_user(&std_id, (void *)arg,
1916| sizeof(v4l2_std_id))) {
1917| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1918| return -14;
1919| }
1920|
1921| do {} while (0)
1922|
1923| ;
1924|
1925| rc = adjust_standard(peasycap, std_id);
1926| if (0 > rc) {
1927| do {} while (0);
1928| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1929| return -2;
1930| }
1931| break;
1932|}
1933|
1934|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((8)) << 0) | (((((sizeof(struct v4l2_requestbuffers) == sizeof(struct v4l2_requestbuffers[1]) && sizeof(struct v4l2_requestbuffers) < (1 << 14)) ? sizeof(struct v4l2_requestbuffers) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1935| int nbuffers;
1936| struct v4l2_requestbuffers v4l2_requestbuffers;
1937|
1938| do {} while (0);
1939|
1940| if (0 != copy_from_user(&v4l2_requestbuffers, (void *)arg,
1941| sizeof(struct v4l2_requestbuffers))) {
1942| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1943| return -14;
1944| }
1945|
1946| if (v4l2_requestbuffers.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
1947| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1948| return -22;
1949| }
1950| if (v4l2_requestbuffers.memory != V4L2_MEMORY_MMAP) {
1951| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1952| return -22;
1953| }
1954| nbuffers = v4l2_requestbuffers.count;
1955| do {} while (0);
1956| if (nbuffers < 2)
1957| nbuffers = 2;
1958| if (nbuffers > 6)
1959| nbuffers = 6;
1960| if (v4l2_requestbuffers.count == nbuffers) {
1961| do {} while (0)
1962| ;
1963| } else {
1964| do {} while (0)
1965| ;
1966| v4l2_requestbuffers.count = nbuffers;
1967| }
1968| peasycap->frame_buffer_many = nbuffers;
1969|
1970| if (0 != copy_to_user((void *)arg, &v4l2_requestbuffers,
1971| sizeof(struct v4l2_requestbuffers))) {
1972| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1973| return -14;
1974| }
1975| break;
1976|}
1977|
1978|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((9)) << 0) | (((((sizeof(struct v4l2_buffer) == sizeof(struct v4l2_buffer[1]) && sizeof(struct v4l2_buffer) < (1 << 14)) ? sizeof(struct v4l2_buffer) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
1979| __u32 index;
1980| struct v4l2_buffer v4l2_buffer;
1981|
1982| do {} while (0);
1983|
1984| if (peasycap->video_eof) {
1985| do {} while (0)
1986| ;
1987| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1988| return -5;
1989| }
1990|
1991| if (0 != copy_from_user(&v4l2_buffer, (void *)arg,
1992| sizeof(struct v4l2_buffer))) {
1993| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1994| return -14;
1995| }
1996|
1997| if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
1998| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
1999| return -22;
2000| }
2001| index = v4l2_buffer.index;
2002| if (index < 0 || index >= peasycap->frame_buffer_many)
2003| return -22;
2004| __st_memset_st__(&v4l2_buffer, 0, sizeof(struct v4l2_buffer));
2005| v4l2_buffer.index = index;
2006| v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
2007| v4l2_buffer.bytesused = peasycap->frame_buffer_used;
2008| v4l2_buffer.flags = 0x0001 |
2009| peasycap->done[index] |
2010| peasycap->queued[index];
2011| v4l2_buffer.field = V4L2_FIELD_NONE;
2012| v4l2_buffer.memory = V4L2_MEMORY_MMAP;
2013| v4l2_buffer.m.offset = index * (405 * ((1UL) << 12));
2014| v4l2_buffer.length = (405 * ((1UL) << 12));
2015|
2016| do {} while (0);
2017| do {} while (0);
2018| do {} while (0);
2019| do {} while (0);
2020| do {} while (0);
2021| do {} while (0)
2022| ;
2023| do {} while (0);
2024| do {} while (0);
2025| do {} while (0);
2026| do {} while (0);
2027|
2028| if (0 != copy_to_user((void *)arg, &v4l2_buffer,
2029| sizeof(struct v4l2_buffer))) {
2030| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2031| return -14;
2032| }
2033| break;
2034|}
2035|
2036|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((15)) << 0) | (((((sizeof(struct v4l2_buffer) == sizeof(struct v4l2_buffer[1]) && sizeof(struct v4l2_buffer) < (1 << 14)) ? sizeof(struct v4l2_buffer) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2037| struct v4l2_buffer v4l2_buffer;
2038|
2039| do {} while (0);
2040|
2041| if (0 != copy_from_user(&v4l2_buffer, (void *)arg,
2042| sizeof(struct v4l2_buffer))) {
2043| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2044| return -14;
2045| }
2046|
2047| if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
2048| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2049| return -22;
2050| }
2051| if (v4l2_buffer.memory != V4L2_MEMORY_MMAP) {
2052| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2053| return -22;
2054| }
2055| if (v4l2_buffer.index < 0 ||
2056| (v4l2_buffer.index >= peasycap->frame_buffer_many)) {
2057| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2058| return -22;
2059| }
2060| v4l2_buffer.flags = 0x0001 | 0x0002;
2061|
2062| peasycap->done[v4l2_buffer.index] = 0;
2063| peasycap->queued[v4l2_buffer.index] = 0x0002;
2064|
2065| if (0 != copy_to_user((void *)arg, &v4l2_buffer,
2066| sizeof(struct v4l2_buffer))) {
2067| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2068| return -14;
2069| }
2070|
2071| do {} while (0)
2072| ;
2073|
2074| peasycap->frame_lock = 0;
2075|
2076| break;
2077|}
2078|
2079|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((17)) << 0) | (((((sizeof(struct v4l2_buffer) == sizeof(struct v4l2_buffer[1]) && sizeof(struct v4l2_buffer) < (1 << 14)) ? sizeof(struct v4l2_buffer) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
2080| {
2081|
2082|
2083|
2084|
2085|
2086|
2087|
2088| struct timeval timeval, timeval2;
2089| int i, j;
2090| struct v4l2_buffer v4l2_buffer;
2091| int rcdq;
2092| __u16 input;
2093|
2094| do {} while (0);
2095|
2096| if ((peasycap->video_idle) || (peasycap->video_eof)) {
2097| do {} while (0)
2098|
2099| ;
2100| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2101| return -5;
2102| }
2103|
2104| if (0 != copy_from_user(&v4l2_buffer, (void *)arg,
2105| sizeof(struct v4l2_buffer))) {
2106| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2107| return -14;
2108| }
2109|
2110| if (v4l2_buffer.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
2111| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2112| return -22;
2113| }
2114|
2115| if (true == peasycap->offerfields) {
2116|
2117|
2118|
2119|
2120|
2121|
2122| if (V4L2_FIELD_TOP == v4l2_buffer.field)
2123| do {} while (0);
2124| else if (V4L2_FIELD_BOTTOM == v4l2_buffer.field)
2125| do {} while (0);
2126| else if (V4L2_FIELD_ANY == v4l2_buffer.field)
2127| do {} while (0);
2128| else
2129| do {} while (0)
2130| ;
2131| }
2132|
2133| if (!peasycap->video_isoc_streaming) {
2134| do {} while (0);
2135| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2136| return -5;
2137| }
2138| if (!peasycap->polled) {
2139| do {
2140| rcdq = easycap_dqbuf(peasycap, 0);
2141| if (-5 == rcdq) {
2142| do {} while (0)
2143| ;
2144| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2145| return -5;
2146| }
2147| } while (0 != rcdq);
2148| } else {
2149| if (peasycap->video_eof) {
2150| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2151| return -5;
2152| }
2153| }
2154| if (0x0004 != peasycap->done[peasycap->frame_read]) {
2155| do { printk("<7>" "easycap::%i%s: " "ERROR: V4L2_BUF_FLAG_DONE != 0x%08X\n", peasycap->isdongle, __func__, peasycap->done[peasycap->frame_read]);} while (0)
2156| ;
2157| }
2158| peasycap->polled = 0;
2159|
2160| if (!(peasycap->isequence % 10)) {
2161| for (i = 0; i < 179; i++)
2162| peasycap->merit[i] = peasycap->merit[i+1];
2163| peasycap->merit[179] = merit_saa(peasycap->pusb_device);
2164| j = 0;
2165| for (i = 0; i < 180; i++)
2166| j += peasycap->merit[i];
2167| if (90 < j) {
2168| do { printk("<7>" "easycap::%i%s: " "easycap driver shutting down " "on condition blue\n", peasycap->isdongle, __func__);} while (0)
2169| ;
2170| peasycap->video_eof = 1; peasycap->audio_eof = 1;
2171| }
2172| }
2173|
2174| v4l2_buffer.index = peasycap->frame_read;
2175| v4l2_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
2176| v4l2_buffer.bytesused = peasycap->frame_buffer_used;
2177| v4l2_buffer.flags = 0x0001 | 0x0004;
2178| if (true == peasycap->offerfields)
2179| v4l2_buffer.field = V4L2_FIELD_BOTTOM;
2180| else
2181| v4l2_buffer.field = V4L2_FIELD_NONE;
2182| do_gettimeofday(&timeval);
2183| timeval2 = timeval;
2184| v4l2_buffer.timestamp = timeval2;
2185| v4l2_buffer.sequence = peasycap->isequence++;
2186| v4l2_buffer.memory = V4L2_MEMORY_MMAP;
2187| v4l2_buffer.m.offset = v4l2_buffer.index * (405 * ((1UL) << 12));
2188| v4l2_buffer.length = (405 * ((1UL) << 12));
2189|
2190| do {} while (0);
2191| do {} while (0);
2192| do {} while (0);
2193| do {} while (0);
2194| do {} while (0);
2195| do {} while (0)
2196| ;
2197| do {} while (0)
2198| ;
2199| do {} while (0);
2200| do {} while (0);
2201| do {} while (0);
2202| do {} while (0);
2203|
2204| if (0 != copy_to_user((void *)arg, &v4l2_buffer,
2205| sizeof(struct v4l2_buffer))) {
2206| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2207| return -14;
2208| }
2209|
2210| input = peasycap->frame_buffer[peasycap->frame_read][0].input;
2211| if (0x08 & input) {
2212| do {} while (0)
2213| ;
2214| } else {
2215| do {} while (0)
2216| ;
2217| }
2218| peasycap->frame_lock = 1;
2219| do {} while (0);
2220| if (peasycap->frame_read == peasycap->frame_fill) {
2221| if (peasycap->frame_lock) {
2222| do {} while (0)
2223| ;
2224| }
2225| }
2226| break;
2227|}
2228|
2229|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((18)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2230| int i;
2231|
2232| do {} while (0);
2233|
2234| peasycap->isequence = 0;
2235| for (i = 0; i < 180; i++)
2236| peasycap->merit[i] = 0;
2237| if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
2238| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
2239| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2240| return -14;
2241| }
2242| submit_video_urbs(peasycap);
2243| peasycap->video_idle = 0;
2244| peasycap->audio_idle = 0;
2245| peasycap->video_eof = 0;
2246| peasycap->audio_eof = 0;
2247| break;
2248|}
2249|
2250|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((19)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2251| do {} while (0);
2252|
2253| if ((struct usb_device *)((void *)0) == peasycap->pusb_device) {
2254| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
2255| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2256| return -14;
2257| }
2258|
2259| peasycap->video_idle = 1;
2260| peasycap->audio_idle = 1; peasycap->timeval0.tv_sec = 0;
2261|
2262|
2263|
2264|
2265|
2266|
2267| do {} while (0);
2268| __wake_up(&(peasycap->wq_video), 1, 1, ((void *)0));
2269| __wake_up(&(peasycap->wq_audio), 1, 1, ((void *)0));
2270|
2271| break;
2272|}
2273|
2274|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((21)) << 0) | (((((sizeof(struct v4l2_streamparm) == sizeof(struct v4l2_streamparm[1]) && sizeof(struct v4l2_streamparm) < (1 << 14)) ? sizeof(struct v4l2_streamparm) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2275| struct v4l2_streamparm *pv4l2_streamparm;
2276|
2277| do {} while (0);
2278| pv4l2_streamparm = kzalloc(sizeof(struct v4l2_streamparm), __st_GFP_KERNEL_st__);
2279| if (!pv4l2_streamparm) {
2280| do { printk("<7>" "easycap::%i%s: " "ERROR: out of memory\n", peasycap->isdongle, __func__);} while (0);
2281| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2282| return -12;
2283| }
2284| if (0 != copy_from_user(pv4l2_streamparm, (void *)arg,
2285| sizeof(struct v4l2_streamparm))) {
2286| kfree(pv4l2_streamparm);
2287| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2288| return -14;
2289| }
2290|
2291| if (pv4l2_streamparm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
2292| kfree(pv4l2_streamparm);
2293| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2294| return -22;
2295| }
2296| pv4l2_streamparm->parm.capture.capability = 0;
2297| pv4l2_streamparm->parm.capture.capturemode = 0;
2298| pv4l2_streamparm->parm.capture.timeperframe.numerator = 1;
2299|
2300| if (peasycap->fps) {
2301| pv4l2_streamparm->parm.capture.timeperframe.
2302| denominator = peasycap->fps;
2303| } else {
2304| if (true == peasycap->ntsc) {
2305| pv4l2_streamparm->parm.capture.timeperframe.
2306| denominator = 30;
2307| } else {
2308| pv4l2_streamparm->parm.capture.timeperframe.
2309| denominator = 25;
2310| }
2311| }
2312|
2313| pv4l2_streamparm->parm.capture.readbuffers =
2314| peasycap->frame_buffer_many;
2315| pv4l2_streamparm->parm.capture.extendedmode = 0;
2316| if (0 != copy_to_user((void *)arg, pv4l2_streamparm,
2317| sizeof(struct v4l2_streamparm))) {
2318| kfree(pv4l2_streamparm);
2319| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2320| return -14;
2321| }
2322| kfree(pv4l2_streamparm);
2323| break;
2324|}
2325|
2326|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((22)) << 0) | (((((sizeof(struct v4l2_streamparm) == sizeof(struct v4l2_streamparm[1]) && sizeof(struct v4l2_streamparm) < (1 << 14)) ? sizeof(struct v4l2_streamparm) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2327| do {} while (0);
2328| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2329| return -22;
2330|}
2331|
2332|case (((2U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((33)) << 0) | (((((sizeof(struct v4l2_audio) == sizeof(struct v4l2_audio[1]) && sizeof(struct v4l2_audio) < (1 << 14)) ? sizeof(struct v4l2_audio) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2333| do {} while (0);
2334| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2335| return -22;
2336|}
2337|
2338|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((34)) << 0) | (((((sizeof(struct v4l2_audio) == sizeof(struct v4l2_audio[1]) && sizeof(struct v4l2_audio) < (1 << 14)) ? sizeof(struct v4l2_audio) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2339| do {} while (0);
2340| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2341| return -22;
2342|}
2343|
2344|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((30)) << 0) | (((((sizeof(struct v4l2_tuner) == sizeof(struct v4l2_tuner[1]) && sizeof(struct v4l2_tuner) < (1 << 14)) ? sizeof(struct v4l2_tuner) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2345| do {} while (0);
2346| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2347| return -22;
2348|}
2349|
2350|case (((2U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((10)) << 0) | (((((sizeof(struct v4l2_framebuffer) == sizeof(struct v4l2_framebuffer[1]) && sizeof(struct v4l2_framebuffer) < (1 << 14)) ? sizeof(struct v4l2_framebuffer) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
2351|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((11)) << 0) | (((((sizeof(struct v4l2_framebuffer) == sizeof(struct v4l2_framebuffer[1]) && sizeof(struct v4l2_framebuffer) < (1 << 14)) ? sizeof(struct v4l2_framebuffer) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
2352|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((14)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2353| do {} while (0);
2354| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2355| return -22;
2356|}
2357|
2358|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((29)) << 0) | (((((sizeof(struct v4l2_tuner) == sizeof(struct v4l2_tuner[1]) && sizeof(struct v4l2_tuner) < (1 << 14)) ? sizeof(struct v4l2_tuner) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2359| do {} while (0);
2360| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2361| return -22;
2362|}
2363|case (((2U|1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((56)) << 0) | (((((sizeof(struct v4l2_frequency) == sizeof(struct v4l2_frequency[1]) && sizeof(struct v4l2_frequency) < (1 << 14)) ? sizeof(struct v4l2_frequency) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))):
2364|case (((1U) << (((0 +8)+8)+14)) | ((('V')) << (0 +8)) | (((57)) << 0) | (((((sizeof(struct v4l2_frequency) == sizeof(struct v4l2_frequency[1]) && sizeof(struct v4l2_frequency) < (1 << 14)) ? sizeof(struct v4l2_frequency) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2365| do {} while (0);
2366| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2367| return -22;
2368|}
2369|
2370|default: {
2371| do {} while (0);
2372| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2373| return -515;
2374|}
2375|}
2376|__st_mutex_unlock_st__(&easycap_dongle[kd].mutex_video);
2377|do {} while (0);
2378|return 0;
2379|}
2380|
2381|
2382|
2383|
2384|long
2385|easysnd_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) {
2386| return (long)easysnd_ioctl((struct inode *)((void *)0), file, cmd, arg);
2387|}
2388|
2389|
2390|
2391|int
2392|easysnd_ioctl(struct inode *inode, struct file *file,
2393| unsigned int cmd, unsigned long arg)
2394|{
2395|struct easycap *peasycap;
2396|struct usb_device *p;
2397|int kd;
2398|
2399|if (((void *)0) == file) {
2400| do { printk("<7>" "easycap:: %s: " "ERROR: file is NULL\n", __func__); } while (0);
2401| return -512;
2402|}
2403|peasycap = file->private_data;
2404|if (((void *)0) == peasycap) {
2405| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL.\n", __func__); } while (0);
2406| return -14;
2407|}
2408|if (memcmp(&peasycap->telltale[0], "expectedstring", strlen("expectedstring"))) {
2409| do { printk("<7>" "easycap:: %s: " "ERROR: bad peasycap\n", __func__); } while (0);
2410| return -14;
2411|}
2412|p = peasycap->pusb_device;
2413|if (((void *)0) == p) {
2414| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
2415| return -14;
2416|}
2417|kd = isdongle(peasycap);
2418|if (0 <= kd && 8 > kd) {
2419| if (__st_mutex_lock_interruptible_st__(&easycap_dongle[kd].mutex_audio)) {
2420| do { printk("<7>" "easycap:: %s: " "ERROR: cannot lock easycap_dongle[%i].mutex_audio\n", __func__, kd); } while (0);
2421| return -512;
2422| }
2423| do {} while (0);
2424|
2425|
2426|
2427|
2428|
2429|
2430|
2431| if (kd != isdongle(peasycap))
2432| return -512;
2433| if (((void *)0) == file) {
2434| do { printk("<7>" "easycap:: %s: " "ERROR: file is NULL\n", __func__); } while (0);
2435| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2436| return -512;
2437| }
2438| peasycap = file->private_data;
2439| if (((void *)0) == peasycap) {
2440| do { printk("<7>" "easycap:: %s: " "ERROR: peasycap is NULL\n", __func__); } while (0);
2441| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2442| return -512;
2443| }
2444| if (memcmp(&peasycap->telltale[0], "expectedstring", strlen("expectedstring"))) {
2445| do { printk("<7>" "easycap:: %s: " "ERROR: bad peasycap\n", __func__); } while (0);
2446| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2447| return -14;
2448| }
2449| p = peasycap->pusb_device;
2450| if (((void *)0) == peasycap->pusb_device) {
2451| do { printk("<7>" "easycap::%i%s: " "ERROR: peasycap->pusb_device is NULL\n", peasycap->isdongle, __func__);} while (0);
2452| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2453| return -512;
2454| }
2455|} else {
2456|
2457|
2458|
2459|
2460|
2461|
2462| return -512;
2463|}
2464|
2465|switch (cmd) {
2466|case (((2U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((15)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2467| int caps;
2468| do {} while (0);
2469|
2470|
2471| if (true == peasycap->microphone)
2472| caps = 0x04400000;
2473| else
2474| caps = 0x04400000;
2475|
2476|
2477|
2478|
2479|
2480|
2481|
2482| if (0 != copy_to_user((void *)arg, &caps, sizeof(int))) {
2483| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2484| return -14;
2485| }
2486| break;
2487|}
2488|case (((2U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((11)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2489| int incoming;
2490| do {} while (0);
2491|
2492|
2493| if (true == peasycap->microphone)
2494| incoming = 0x00000010;
2495| else
2496| incoming = 0x00000010;
2497|
2498|
2499|
2500|
2501|
2502|
2503|
2504| if (0 != copy_to_user((void *)arg, &incoming, sizeof(int))) {
2505| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2506| return -14;
2507| }
2508| break;
2509|}
2510|case (((2U|1U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((5)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2511| int incoming, outgoing;
2512| do {} while (0);
2513| if (0 != copy_from_user(&incoming, (void *)arg, sizeof(int))) {
2514| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2515| return -14;
2516| }
2517| do {} while (0);
2518|
2519|
2520| if (true == peasycap->microphone)
2521| outgoing = 0x00000010;
2522| else
2523| outgoing = 0x00000010;
2524|
2525|
2526|
2527|
2528|
2529|
2530|
2531| if (incoming != outgoing) {
2532| do {} while (0);
2533| do {} while (0);
2534| do {} while (0);
2535| if (0 != copy_to_user((void *)arg, &outgoing,
2536| sizeof(int))) {
2537| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2538| return -14;
2539| }
2540| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2541| return -22 ;
2542| }
2543| break;
2544|}
2545|case (((2U|1U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((3)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2546| int incoming;
2547| do {} while (0);
2548| if (0 != copy_from_user(&incoming, (void *)arg, sizeof(int))) {
2549| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2550| return -14;
2551| }
2552| do {} while (0);
2553|
2554|
2555| if (true == peasycap->microphone)
2556| incoming = 1;
2557| else
2558| incoming = 1;
2559|
2560|
2561|
2562|
2563|
2564|
2565|
2566| if (0 != copy_to_user((void *)arg, &incoming, sizeof(int))) {
2567| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2568| return -14;
2569| }
2570| break;
2571|}
2572|case (((2U|1U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((2)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2573| int incoming;
2574| do {} while (0);
2575| if (0 != copy_from_user(&incoming, (void *)arg, sizeof(int))) {
2576| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2577| return -14;
2578| }
2579| do {} while (0);
2580|
2581|
2582| if (true == peasycap->microphone)
2583| incoming = 32000;
2584| else
2585| incoming = 48000;
2586|
2587|
2588|
2589|
2590|
2591|
2592|
2593| if (0 != copy_to_user((void *)arg, &incoming, sizeof(int))) {
2594| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2595| return -14;
2596| }
2597| break;
2598|}
2599|case (((2U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((16)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2600| int incoming;
2601| do {} while (0);
2602| if (0 != copy_from_user(&incoming, (void *)arg, sizeof(int))) {
2603| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2604| return -14;
2605| }
2606| do {} while (0);
2607|
2608| incoming = 0x00000001;
2609| if (0 != copy_to_user((void *)arg, &incoming, sizeof(int))) {
2610| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2611| return -14;
2612| }
2613| break;
2614|}
2615|case (((1U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((16)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2616| int incoming;
2617| do {} while (0);
2618| if (0 != copy_from_user(&incoming, (void *)arg, sizeof(int))) {
2619| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2620| return -14;
2621| }
2622| do {} while (0);
2623| do {} while (0)
2624|
2625| ;
2626| ;
2627| ;
2628| ;
2629| ;
2630| break;
2631|}
2632|case (((2U|1U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((4)) << 0) | (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ? sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2633| int incoming;
2634| do {} while (0);
2635| if (0 != copy_from_user(&incoming, (void *)arg, sizeof(int))) {
2636| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2637| return -14;
2638| }
2639| do {} while (0);
2640| incoming = peasycap->audio_bytes_per_fragment;
2641| if (0 != copy_to_user((void *)arg, &incoming, sizeof(int))) {
2642| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2643| return -14;
2644| }
2645| break;
2646|}
2647|case (((2U) << (((0 +8)+8)+14)) | ((('P')) << (0 +8)) | (((13)) << 0) | (((((sizeof(audio_buf_info) == sizeof(audio_buf_info[1]) && sizeof(audio_buf_info) < (1 << 14)) ? sizeof(audio_buf_info) : __invalid_size_argument_for_IOC))) << ((0 +8)+8))): {
2648| struct audio_buf_info audio_buf_info;
2649|
2650| do {} while (0);
2651|
2652| audio_buf_info.bytes = peasycap->audio_bytes_per_fragment;
2653| audio_buf_info.fragments = 1;
2654| audio_buf_info.fragsize = 0;
2655| audio_buf_info.fragstotal = 0;
2656|
2657| if (0 != copy_to_user((void *)arg, &audio_buf_info,
2658| sizeof(int))) {
2659| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2660| return -14;
2661| }
2662| break;
2663|}
2664|case 0x00005401:
2665|case 0x00005402:
2666|case 0x00005403:
2667|case 0x00005404:
2668|case 0x00005405:
2669|case 0x00005406: {
2670| do {} while (0);
2671| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2672| return -515;
2673|}
2674|default: {
2675| do {} while (0);
2676| __st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2677| return -515;
2678|}
2679|}
2680|__st_mutex_unlock_st__(&easycap_dongle[kd].mutex_audio);
2681|return 0;
2682|}