⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x405.html

📁 usb develop guide
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN"><HTML><HEAD><TITLE>USB and Digital Still Cameras</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet"><LINKREL="HOME"TITLE="The Linux USB sub-system"HREF="book1.html"><LINKREL="UP"TITLE="How to get USB devices working under Linux"HREF="c122.html"><LINKREL="PREVIOUS"TITLE="USB Cameras"HREF="x370.html"><LINKREL="NEXT"TITLE="Mass Storage Devices"HREF="x498.html"></HEAD><BODY><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">The Linux USB sub-system</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="x370.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 2. How to get USB devices working under Linux</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x498.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="AEN405">USB and Digital Still Cameras</A></H1><P> While most digital still cameras support a serial line    at up to 115 Kbps, the fastest ways to get pictures out of your    camera onto Linux involve USB:    <P></P><DL><DT><ICLASS="EMPHASIS">             USB Connection for Camera</I></DT><DD><P>Some cameras can connect directly to USB,            normally using a custom jack on the camera, which is smaller            than the standard type B jacks you see on the upstream side            of hubs and other devices. </P></DD><DT><ICLASS="EMPHASIS">            USB Connection for Memory</I></DT><DD><P>A number of cameras don't have a direct USB            hookup, but may come with an adapter that lets you connect            their memory cards instead.  Those cards are accessed using            the mass storage driver, as if they were disk drives.  (USB            mass storage support is discussed elsewhere in this document.)            You can buy such adapters separately; be sure that Linux supports            the adapter model you want to use.</P></DD><DT><ICLASS="EMPHASIS">            PCMCIA Connection for Memory</I></DT><DD><P>Inexpensive PCMCIA adapters ($10US) let you            treat memory cards like IDE disks.  This won't be discussed            any further here, but you should know the option exists.  The            transfer rate is higher than for USB, but the downside is that            PCMCIA support is generally only available on laptops.            </P></DD></DL>        </P><P> Only the first of these approaches is discussed in this    section, where the camera has a direct connection to USB.  The    table below summarizes the most important information: </P><DIVCLASS="INFORMALTABLE"><P></P><TABLEBORDER="1"CLASS="CALSTABLE"><TR><THALIGN="LEFT"VALIGN="TOP">Still Camera</TH><THALIGN="LEFT"VALIGN="TOP">Drivers</TH><THALIGN="LEFT"VALIGN="TOP">Applications</TH><THALIGN="LEFT"VALIGN="TOP">Notes</TH></TR><TR><TDALIGN="LEFT"VALIGN="TOP">Kodak DC-240/280</TD><TDALIGN="LEFT"VALIGN="TOP">dc2xx</TD><TDALIGN="LEFT"VALIGN="TOP"> gPhoto</TD><TDALIGN="LEFT"VALIGN="TOP">The first still cameras supported under Linux.                        USB lets you download pictures, take new ones,                        change camera settings, and more.  </TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">Kodak DC-220/260/265/290,                        HP PhotoSmart C-500</TD><TDALIGN="LEFT"VALIGN="TOP">dc2xx</TD><TDALIGN="LEFT"VALIGN="TOP">ODS (no GUI)</TD><TDALIGN="LEFT"VALIGN="TOP">DigitaOS runs these cameras, letting you                        run scripts on the camera as well as the sort                        of functionality available on the other                        DC-2xx series USB cameras. </TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">Mustek MDC-800</TD><TDALIGN="LEFT"VALIGN="TOP">mdc800</TD><TDALIGN="LEFT"VALIGN="TOP">gPhoto</TD><TDALIGN="LEFT"VALIGN="TOP">Only one camera at a time supported. </TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">Sony DSC-505,                        Toshiba PDR-M4,                        and many USB card readers                        </TD><TDALIGN="LEFT"VALIGN="TOP">storage, fat filesystem</TD><TDALIGN="LEFT"VALIGN="TOP">ls, cp, mc, &amp;c.</TD><TDALIGN="LEFT"VALIGN="TOP">readonly for now </TD></TR></TABLE><P></P></DIV><P> Your kernel may already have the <ICLASS="EMPHASIS">dc2xx</I>,    <ICLASS="EMPHASIS">mdc800</I> and <ICLASS="EMPHASIS">storage</I> compiled    as modules, or as part of the kernel.  If it doesn't, rebuild so that    you have them available. </P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN458">Filesystem Device Nodes</A></H2><P> If you use the dc2xx or mdc800 driver, you have all the security         hooks you need.  The instructions shown below assume that PAM will be        set up to change ownership of these nodes to the logged-in user using        the <TTCLASS="FILENAME">/etc/console.perms</TT> file.  If that is not done,        think carefully about the ownership and permissions you use in the        instructions below.  (Mode 0666 works for trusted systems, such        as single users workstations with no rlogin.) </P><P> The dc2xx driver supports up to sixteen devices, but most users        won't need to use more than one or two cameras.  If these device nodes        aren't part of your distribution, make at least the first few of them        as follows:        <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="SCREEN">        # mknod -m 0660 /dev/usb/dc2xx0 c 180 80        # mknod -m 0660 /dev/usb/dc2xx1 c 180 81        # mknod -m 0660 /dev/usb/dc2xx2 c 180 82        # mknod -m 0660 /dev/usb/dc2xx3 c 180 83        ...        # mknod -m 0660 /dev/usb/dc2xx15 c 180 95        </PRE></TD></TR></TABLE></P><P> The mdc800 driver supports one device.  If its device node        isn't part of your distribution, make it as follows:        <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="SCREEN">        # mknod -m 0660 /dev/usb/mdc800 c 180 32        </PRE></TD></TR></TABLE></P><P> If your connectivity uses the storage driver, see        the section on that driver for more information. </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN467">Sanity Checking</A></H2><P> After you think your kernel is set up, connect your camera to        your computer with USB (power it up!) and check to see if a kernel        message (perhaps in <TTCLASS="FILENAME">/var/log/messages</TT>)        reports the driver saw the        camera.  If it didn't, you can do a bit of troubleshooting if you've        got "procfs" and the prototype "usbdevfs" code set up. </P><P> The first check is whether USB is basically set up.  You        should see the driver listed in <TTCLASS="FILENAME">/proc/bus/usb/drivers</TT>;        if it's not there, use "modprobe" to load it.  There should be a        bus directory such as <TTCLASS="FILENAME">/proc/bus/usb/001</TT> also; if        there isn't, you may need to        "modprobe" the right host controller driver (OHCI or UHCI). </P><P> Then make sure that the kernel saw the camera.  With it still        connected and powered up, check for an entry in        <TTCLASS="FILENAME">/proc/bus/usb/devices</TT>        corresponding to your camera.  (The product ID string may name it.)        If there is no camera there, check your USB connections.  If you        find the camera listed there, make sure it's one of the supported        cameras.  There should be an "I: ..." line showing that driver.  For        example, at the end of the line it would have "Driver=dc2xx",        "Driver=mdc800", or "Driver=storage".  If you don't see that, then        the troubleshooting gets interesting.  </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN476">gPhoto</A></H2><P> gPhoto is a graphical application that knows how to talk to many         different digital cameras.  At this writing its current version (0.4.3)         knows how to use USB to talk to three cameras:        appropriate camera model and use an "other" (non-TTY) device path        name as shown above.  (Use dc2xx0 unless you have multiple cameras.)        Check the "Camera Summary" to see if it's connected properly. </P><P> At that point, you should be able to download thumbnails of        all the pictures in the camera, then download the pictures you've        chosen.  (At this writing, it's visibly faster to use OHCI than        to use UHCI.) </P><P> More information about gPhoto is available at its web site,        <AHREF="http://www.gPhoto.org/"TARGET="_top">www.gPhoto.org</A>. </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN482">DigitaOS Cameras and ODS</A></H2><P> At this writing, gPhoto does not know how to communicate        with cameras using the "DigitaOS" environment.  However, there is        a separate "Open Digita Services" project which can be used to        do that.  See that project's web site, at        <AHREF="http://ods.sourceforge.net/"TARGET="_top">ods.sourceforge.net</A>.        </P><P> (There are also various Perl and Python scripts available        to provide some of this functionality, if you prefer to develop        in those languages rather than in C.) </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN487">Other Approaches (Developers only)</A></H2><P>The solutions described above are, at this writing, the        most widely used ones.  You may be interested to know about        some other solutions that might work. </P><P> You can configure the <ICLASS="EMPHASIS">usbserial</I>        module with "generic serial" driver support.  This lets you        provide kernel module parameters that let the serial driver        handle specific bulk-only devices (using USB product and        vendor IDs).  The Kodak or ODS cameras mentioned above are        bulk-only, so this might permit <TTCLASS="FILENAME">/dev/usb/ttyN</TT>        style paths to work instead of <TTCLASS="FILENAME">/dev/usb/dc2xxN</TT>        style ones.</P><P> Systems which enable the "prototype usbdevfs" support        can configure it to allow appropriately intelligent user        mode programs to access USB devices.  This requires libraries        that know how to interact with <TTCLASS="FILENAME">/proc/bus/usb/NNN/MMM</TT>        files for each USB device, ways to address security issues that        arise (programs need read/write access), and ways to have        user and kernel mode software interact safely.  Such work        is under way.  See for example the Java USB project  at        <AHREF="http://jusb.sourceforge.net/"TARGET="_top">jusb.sourceforge.net</A>        and the C "libusb" at <AHREF="http://libusb.sourceforge.net/"TARGET="_top">libusb.sourceforge.net</A>        </P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x370.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="book1.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x498.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">USB Cameras</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="c122.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Mass Storage Devices</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -