1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>ioctl VIDIOC_G_CHIP_IDENT</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9REL="HOME"
10TITLE="Video for Linux Two API Specification"
11HREF="book1.htm"><LINK
12REL="UP"
13TITLE="Function Reference"
14HREF="r7624.htm"><LINK
15REL="PREVIOUS"
16TITLE="ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT"
17HREF="r9688.htm"><LINK
18REL="NEXT"
19TITLE="ioctl VIDIOC_G_CROP, VIDIOC_S_CROP"
20HREF="r9994.htm"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFFFFF"
24TEXT="#000000"
25LINK="#0000FF"
26VLINK="#840084"
27ALINK="#0000FF"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>Video for Linux Two API Specification: Revision 0.24</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="r9688.htm"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="r9994.htm"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="VIDIOC-G-CHIP-IDENT"
74></A
75>ioctl VIDIOC_G_CHIP_IDENT</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN9808"
80></A
81><H2
82>Name</H2
83>VIDIOC_G_CHIP_IDENT&nbsp;--&nbsp;Identify the chips on a TV card</DIV
84><DIV
85CLASS="REFSYNOPSISDIV"
86><A
87NAME="AEN9811"
88></A
89><H2
90>Synopsis</H2
91><DIV
92CLASS="FUNCSYNOPSIS"
93><P
94></P
95><A
96NAME="AEN9812"
97></A
98><P
99><CODE
100><CODE
101CLASS="FUNCDEF"
102>int ioctl</CODE
103>(int fd, int request, struct v4l2_chip_ident
104*argp);</CODE
105></P
106><P
107></P
108></DIV
109></DIV
110><DIV
111CLASS="REFSECT1"
112><A
113NAME="AEN9822"
114></A
115><H2
116>Arguments</H2
117><P
118></P
119><DIV
120CLASS="VARIABLELIST"
121><DL
122><DT
123><CODE
124CLASS="PARAMETER"
125>fd</CODE
126></DT
127><DD
128><P
129>File descriptor returned by <A
130HREF="r14090.htm"
131><CODE
132CLASS="FUNCTION"
133>open()</CODE
134></A
135>.</P
136></DD
137><DT
138><CODE
139CLASS="PARAMETER"
140>request</CODE
141></DT
142><DD
143><P
144>VIDIOC_G_CHIP_IDENT</P
145></DD
146><DT
147><CODE
148CLASS="PARAMETER"
149>argp</CODE
150></DT
151><DD
152><P
153></P
154></DD
155></DL
156></DIV
157></DIV
158><DIV
159CLASS="REFSECT1"
160><A
161NAME="AEN9842"
162></A
163><H2
164>Description</H2
165><DIV
166CLASS="NOTE"
167><BLOCKQUOTE
168CLASS="NOTE"
169><P
170><B
171>Experimental: </B
172>This is an <A
173HREF="x16453.htm"
174>experimental</A
175> interface and may change in
176the future.</P
177></BLOCKQUOTE
178></DIV
179><P
180>For driver debugging purposes this ioctl allows test
181applications to query the driver about the chips present on the TV
182card. Regular applications should not use it. When you found a chip
183specific bug, please contact the Video4Linux mailing list (<A
184HREF="https://listman.redhat.com/mailman/listinfo/video4linux-list"
185TARGET="_top"
186>https://listman.redhat.com/mailman/listinfo/video4linux-list</A
187>)
188so it can be fixed.</P
189><P
190>To query the driver applications must initialize the
191<CODE
192CLASS="STRUCTFIELD"
193>match_type</CODE
194> and
195<CODE
196CLASS="STRUCTFIELD"
197>match_chip</CODE
198> fields of a struct&nbsp;<A
199HREF="r9804.htm#V4L2-CHIP-IDENT"
200>v4l2_chip_ident</A
201>
202and call <CODE
203CLASS="CONSTANT"
204>VIDIOC_G_CHIP_IDENT</CODE
205> with a pointer to
206this structure. On success the driver stores information about the
207selected chip in the <CODE
208CLASS="STRUCTFIELD"
209>ident</CODE
210> and
211<CODE
212CLASS="STRUCTFIELD"
213>revision</CODE
214> fields. On failure the structure
215remains unchanged.</P
216><P
217>When <CODE
218CLASS="STRUCTFIELD"
219>match_type</CODE
220> is
221<CODE
222CLASS="CONSTANT"
223>V4L2_CHIP_MATCH_HOST</CODE
224>,
225<CODE
226CLASS="STRUCTFIELD"
227>match_chip</CODE
228> selects the nth non-I<SUP
229>2</SUP
230>C chip
231on the TV card. You can enumerate all chips by starting at zero and
232incrementing <CODE
233CLASS="STRUCTFIELD"
234>match_chip</CODE
235> by one until
236<CODE
237CLASS="CONSTANT"
238>VIDIOC_G_CHIP_IDENT</CODE
239> fails with an <SPAN
240CLASS="ERRORCODE"
241>EINVAL</SPAN
242> error code.
243Drivers may also interpret <CODE
244CLASS="STRUCTFIELD"
245>match_chip</CODE
246> as a
247random ID, but we recommend against that. The number zero always
248selects the host chip, e.&nbsp;g. the chip connected to the PCI bus.</P
249><P
250>When <CODE
251CLASS="STRUCTFIELD"
252>match_type</CODE
253> is
254<CODE
255CLASS="CONSTANT"
256>V4L2_CHIP_MATCH_I2C_DRIVER</CODE
257>,
258<CODE
259CLASS="STRUCTFIELD"
260>match_chip</CODE
261> contains a driver ID as defined
262in the <TT
263CLASS="FILENAME"
264>linux/i2c-id.h</TT
265> header file. For instance
266<CODE
267CLASS="CONSTANT"
268>I2C_DRIVERID_SAA7127</CODE
269> will match any chip
270supported by the saa7127 driver, regardless of its I<SUP
271>2</SUP
272>C bus address.
273When multiple chips supported by the same driver are present, the
274ioctl will return <CODE
275CLASS="CONSTANT"
276>V4L2_IDENT_AMBIGUOUS</CODE
277> in the
278<CODE
279CLASS="STRUCTFIELD"
280>ident</CODE
281> field.</P
282><P
283>When <CODE
284CLASS="STRUCTFIELD"
285>match_type</CODE
286> is
287<CODE
288CLASS="CONSTANT"
289>V4L2_CHIP_MATCH_I2C_ADDR</CODE
290>,
291<CODE
292CLASS="STRUCTFIELD"
293>match_chip</CODE
294> selects a chip by its 7 bit
295I<SUP
296>2</SUP
297>C bus address.</P
298><P
299>On success, the <CODE
300CLASS="STRUCTFIELD"
301>ident</CODE
302> field will
303contain a chip ID from the Linux
304<TT
305CLASS="FILENAME"
306>media/v4l2-chip-ident.h</TT
307> header file, and the
308<CODE
309CLASS="STRUCTFIELD"
310>revision</CODE
311> field will contain a driver
312specific value, or zero if no particular revision is associated with
313this chip.</P
314><P
315>When the driver could not identify the selected chip,
316<CODE
317CLASS="STRUCTFIELD"
318>ident</CODE
319> will contain
320<CODE
321CLASS="CONSTANT"
322>V4L2_IDENT_UNKNOWN</CODE
323>. When no chip matched
324<CODE
325CLASS="STRUCTFIELD"
326>match_type</CODE
327> and
328<CODE
329CLASS="STRUCTFIELD"
330>match_chip</CODE
331>, the ioctl will succeed but the
332<CODE
333CLASS="STRUCTFIELD"
334>ident</CODE
335> field will contain
336<CODE
337CLASS="CONSTANT"
338>V4L2_IDENT_NONE</CODE
339>. If multiple chips matched,
340<CODE
341CLASS="STRUCTFIELD"
342>ident</CODE
343> will contain
344<CODE
345CLASS="CONSTANT"
346>V4L2_IDENT_AMBIGUOUS</CODE
347>. In all these cases the
348<CODE
349CLASS="STRUCTFIELD"
350>revision</CODE
351> field remains unchanged.</P
352><P
353>This ioctl is optional, not all drivers may support it. It
354was introduced in Linux 2.6.21.</P
355><P
356>We recommended the <SPAN
357CLASS="APPLICATION"
358>v4l2-dbg</SPAN
359>
360utility over calling this ioctl directly. It is available from the
361LinuxTV v4l-dvb repository; see <A
362HREF="http://linuxtv.org/repo/"
363TARGET="_top"
364>http://linuxtv.org/repo/</A
365> for
366access instructions.</P
367><DIV
368CLASS="TABLE"
369><A
370NAME="V4L2-CHIP-IDENT"
371></A
372><P
373><B
374>Table 1. struct <CODE
375CLASS="STRUCTNAME"
376>v4l2_chip_ident</CODE
377></B
378></P
379><TABLE
380BORDER="0"
381FRAME="void"
382WIDTH="100%"
383CLASS="CALSTABLE"
384><COL
385WIDTH="25%"
386TITLE="C1"><COL
387WIDTH="25%"
388TITLE="C2"><COL
389WIDTH="50%"
390TITLE="C3"><TBODY
391VALIGN="TOP"
392><TR
393><TD
394>__u32</TD
395><TD
396><CODE
397CLASS="STRUCTFIELD"
398>match_type</CODE
399></TD
400><TD
401>See <A
402HREF="r9804.htm#IDENT-CHIP-MATCH-TYPES"
403>Table 2</A
404> for a list of
405possible types.</TD
406></TR
407><TR
408><TD
409>__u32</TD
410><TD
411><CODE
412CLASS="STRUCTFIELD"
413>match_chip</CODE
414></TD
415><TD
416>Match a chip by this number, interpreted according
417to the <CODE
418CLASS="STRUCTFIELD"
419>match_type</CODE
420> field.</TD
421></TR
422><TR
423><TD
424>__u32</TD
425><TD
426><CODE
427CLASS="STRUCTFIELD"
428>ident</CODE
429></TD
430><TD
431>A chip identifier as defined in the Linux
432<TT
433CLASS="FILENAME"
434>media/v4l2-chip-ident.h</TT
435> header file, or one of
436the values from <A
437HREF="r9804.htm#CHIP-IDS"
438>Table 3</A
439>.</TD
440></TR
441><TR
442><TD
443>__u32</TD
444><TD
445><CODE
446CLASS="STRUCTFIELD"
447>revision</CODE
448></TD
449><TD
450>A chip revision, chip and driver specific.</TD
451></TR
452></TBODY
453></TABLE
454></DIV
455><DIV
456CLASS="TABLE"
457><A
458NAME="IDENT-CHIP-MATCH-TYPES"
459></A
460><P
461><B
462>Table 2. Chip Match Types</B
463></P
464><TABLE
465BORDER="0"
466FRAME="void"
467WIDTH="100%"
468CLASS="CALSTABLE"
469><COL
470WIDTH="38%"
471TITLE="C1"><COL
472WIDTH="12%"
473TITLE="C2"><COL
474WIDTH="50%"
475TITLE="C3"><TBODY
476VALIGN="TOP"
477><TR
478><TD
479><CODE
480CLASS="CONSTANT"
481>V4L2_CHIP_MATCH_HOST</CODE
482></TD
483><TD
484>0</TD
485><TD
486>Match the nth chip on the card, zero for the
487            host chip. Does not match I<SUP
488>2</SUP
489>C chips.</TD
490></TR
491><TR
492><TD
493><CODE
494CLASS="CONSTANT"
495>V4L2_CHIP_MATCH_I2C_DRIVER</CODE
496></TD
497><TD
498>1</TD
499><TD
500>Match an I<SUP
501>2</SUP
502>C chip by its driver ID from the
503<TT
504CLASS="FILENAME"
505>linux/i2c-id.h</TT
506> header file.</TD
507></TR
508><TR
509><TD
510><CODE
511CLASS="CONSTANT"
512>V4L2_CHIP_MATCH_I2C_ADDR</CODE
513></TD
514><TD
515>2</TD
516><TD
517>Match a chip by its 7 bit I<SUP
518>2</SUP
519>C bus address.</TD
520></TR
521></TBODY
522></TABLE
523></DIV
524><DIV
525CLASS="TABLE"
526><A
527NAME="CHIP-IDS"
528></A
529><P
530><B
531>Table 3. Chip Identifiers</B
532></P
533><TABLE
534BORDER="0"
535FRAME="void"
536WIDTH="100%"
537CLASS="CALSTABLE"
538><COL
539WIDTH="38%"
540TITLE="C1"><COL
541WIDTH="12%"
542TITLE="C2"><COL
543WIDTH="50%"
544TITLE="C3"><TBODY
545VALIGN="TOP"
546><TR
547><TD
548><CODE
549CLASS="CONSTANT"
550>V4L2_IDENT_NONE</CODE
551></TD
552><TD
553>0</TD
554><TD
555>No chip matched.</TD
556></TR
557><TR
558><TD
559><CODE
560CLASS="CONSTANT"
561>V4L2_IDENT_AMBIGUOUS</CODE
562></TD
563><TD
564>1</TD
565><TD
566>Multiple chips matched.</TD
567></TR
568><TR
569><TD
570><CODE
571CLASS="CONSTANT"
572>V4L2_IDENT_UNKNOWN</CODE
573></TD
574><TD
575>2</TD
576><TD
577>A chip is present at this address, but the driver
578could not identify it.</TD
579></TR
580></TBODY
581></TABLE
582></DIV
583></DIV
584><DIV
585CLASS="REFSECT1"
586><A
587NAME="AEN9981"
588></A
589><H2
590>Return Value</H2
591><P
592>On success <SPAN
593CLASS="RETURNVALUE"
594>0</SPAN
595> is returned, on error <SPAN
596CLASS="RETURNVALUE"
597>-1</SPAN
598> and the <CODE
599CLASS="VARNAME"
600>errno</CODE
601> variable is set appropriately:</P
602><P
603></P
604><DIV
605CLASS="VARIABLELIST"
606><DL
607><DT
608><SPAN
609CLASS="ERRORCODE"
610>EINVAL</SPAN
611></DT
612><DD
613><P
614>The driver does not support this ioctl, or the
615<CODE
616CLASS="STRUCTFIELD"
617>match_type</CODE
618> is invalid.</P
619></DD
620></DL
621></DIV
622></DIV
623><DIV
624CLASS="NAVFOOTER"
625><HR
626ALIGN="LEFT"
627WIDTH="100%"><TABLE
628SUMMARY="Footer navigation table"
629WIDTH="100%"
630BORDER="0"
631CELLPADDING="0"
632CELLSPACING="0"
633><TR
634><TD
635WIDTH="33%"
636ALIGN="left"
637VALIGN="top"
638><A
639HREF="r9688.htm"
640ACCESSKEY="P"
641>Prev</A
642></TD
643><TD
644WIDTH="34%"
645ALIGN="center"
646VALIGN="top"
647><A
648HREF="book1.htm"
649ACCESSKEY="H"
650>Home</A
651></TD
652><TD
653WIDTH="33%"
654ALIGN="right"
655VALIGN="top"
656><A
657HREF="r9994.htm"
658ACCESSKEY="N"
659>Next</A
660></TD
661></TR
662><TR
663><TD
664WIDTH="33%"
665ALIGN="left"
666VALIGN="top"
667>ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT</TD
668><TD
669WIDTH="34%"
670ALIGN="center"
671VALIGN="top"
672><A
673HREF="r7624.htm"
674ACCESSKEY="U"
675>Up</A
676></TD
677><TD
678WIDTH="33%"
679ALIGN="right"
680VALIGN="top"
681>ioctl VIDIOC_G_CROP, VIDIOC_S_CROP</TD
682></TR
683></TABLE
684></DIV
685></BODY
686></HTML
687>
688