亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? linux.java

?? JAVA 訪(fǎng)問(wèn)USB JAVA 訪(fǎng)問(wèn)USB JAVA 訪(fǎng)問(wèn)USB JAVA 訪(fǎng)問(wèn)USB JAVA 訪(fǎng)問(wèn)USB JAVA 訪(fǎng)問(wèn)USB
?? JAVA
字號(hào):
/*
 * Java USB Library
 * Copyright (C) 2000 by David Brownell
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package usb.linux;

import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

import usb.core.*;


/**
 * Provides access to native USB host object for this process.
 *
 * @see usb.remote.HostProxy
 *
 * @author David Brownell
 * @version $Id: Linux.java,v 1.3 2000/12/15 19:02:21 dbrownell Exp $
 */
public final class Linux extends HostFactory
{
    // package private
    static final boolean		trace = false;
    static final boolean		debug = false;

    private static Linux.HostImpl	self;


    /**
     * Not part of the API; implements reference implementation SPI.
     */
    public Linux () { }

    /**
     * Not part of the API; implements reference implementation SPI.
     */
    public Host createHost () throws IOException { return Linux.getHost (); }


    /**
     * Provides access to the singleton USB Host.
     * This creates a "USB Watcher" daemon thread, which
     * keeps USB device and bus connectivity data current.
     *
     * @return the host, or null if USB support isn't available.
     * @exception IOException for file access problems
     * @exception SecurityException when usbdevfs hasn't been set
     *	up to allow this process to read and write all device nodes
     * @exception RuntimeException various runtime exceptions may
     *	be thrown if the USB information provided by the system
     *	doesn't appear to make sense.
     */
    public static Host getHost ()
    throws IOException, SecurityException
    {
	synchronized (Host.class) {
	    if (self == null) {

		// no existing host; make our own.
		File f = new File ("/proc/bus/usb");
		if (!f.exists () || !f.isDirectory ()) {
		    System.err.println (
			"Java USB for Linux needs usbdevfs to run."
			);
		    return null;
		}

		// With GCJ we expect to run native, not interpreted,
		// and use CNI glue instead of a separate JNI library.
		if (!"libgcj".equals (System.getProperty ("java.vm.name")))
		    System.loadLibrary ("jusb");

		self = new Linux.HostImpl (f);
	    }
	}
	return self;
    }



    /******************************************************************/

    // FIXME: provide some way to expose devfs info, so we have it
    // as an integration option for other Linux/GNOME/... apps.

    static private String	devfsPath;
    static private Watcher	watcher;
    static private Thread	daemon;

    /**
     * Represents a Linux host associated with one or more
     * Universal Serial Busses (USBs).
     */
    private static final class HostImpl implements Host
    {
	private final transient Hashtable	busses = new Hashtable (3);
	private final transient Vector		listeners = new Vector (3);

	HostImpl (File directory)
	throws IOException, SecurityException
	// and RuntimeException on any of several errors
	{
	    super ();

	    devfsPath = directory.getAbsolutePath ();
	    watcher = new Watcher (directory, busses, listeners);
	    
	    daemon = new Thread (watcher, "USB-Watcher");
	    daemon.setDaemon (true);
	    daemon.start ();
	}

	protected void finalize ()
	{
	    watcher.halt ();
	    daemon.interrupt ();
	}

	public String toString ()
	{
	    return "Linux usbfs";
	}

	/**
	 * Returns an array of objects representing the USB busses currently
	 * in this system.
	 */
	public Bus [] getBusses ()
	{
	    synchronized (busses) {
		Bus		retval [] = new Bus [busses.size ()];
		int		i = 0;

		for (Enumeration e = busses.keys (); e.hasMoreElements (); )
		    retval [i++] = (Bus) busses.get (e.nextElement ());
		return retval;
	    }
	}

	public usb.core.Device getDevice (String portId)
	throws IOException
	{
	    return new PortIdentifier (portId).getDevice (this);
	}


	/** Adds a callback for USB structure changes */
	public void addUSBListener (USBListener l)
	{
	    if (l == null)
		throw new IllegalArgumentException ();
	    listeners.addElement (l);
	}
	    
	/** Removes a callback for USB structure changes */
	public void removeUSBListener (USBListener l)
	{
	    // value ignored
	    listeners.removeElement (l);
	}
    }


    // hubs usually get polled for interrupts every 255ms ...
    static final int POLL_PERIOD = 2;	// seconds


    /**
     * Scan for bus additions/removals/changes, delegating
     * most work to the 
     */
    private static final class Watcher implements Runnable
    {
	private File			dir;
	private File			devices;
	private final Hashtable		busses;
	private final Vector		listeners;
	private long			lastTime;

	// package private
	Watcher (File d, Hashtable b, Vector l)
	throws IOException, SecurityException
	// throws RuntimeException on any of several errors
	{
	    dir = d;
	    devices = new File (dir, "devices");
	    busses = b;
	    listeners = l;
	    if (!dir.exists () || !dir.isDirectory ())
		throw new IOException (
		      "is usbdevfs mounted?  "
		    + d.getAbsolutePath ());

	    // initial population of this bus
	    while (scan ())
		continue;
	    
	    if (busses.isEmpty ())
		throw new IOException (
		    "no devices; maybe usbdevfs denies read/write access?"); 
	}

	public void run ()
	{
	    while (dir != null) {

		// No matter how we learn that something may have
		// changed, we do the same thing to figure out
		// exactly what changed:  scan usbdevfs
		while (scan ())
		    continue;

		// FIXME:  add native support to poll() on
		// /proc/bus/usb/devices ...

		try { Thread.sleep (POLL_PERIOD * 1000); }
		catch (InterruptedException e) {
		    // set dir to null to cause a clean exit
		}
	    }
	}

	void halt ()
	{
	    dir = null;
	}

	private boolean scan ()
	throws SecurityException
	{
	    boolean	changed = false;

	    synchronized (busses) {
		long	current = System.currentTimeMillis ();
		long	mtime = devices.lastModified ();

		if (lastTime > mtime) {
		    // works since 2.4.0-test8 or so
		    if (trace)
			System.err.println ("Host.scan: unmodified");
		    return false;
		}
		if (trace)
		    System.err.println ("Host.scan: modified ...");

		// what busses exist now?
		String	kids [] = dir.list ();
		Vector	seen;

		if (kids.length < 2)
		    throw new IllegalArgumentException (
				dir.getAbsolutePath ());

		seen = new Vector (kids.length - 2);
		for (int i = 0; i < kids.length; i++) {
		    int	busnum;
		    try {
			// Bus number:  "001", "002", ...
			busnum = Integer.parseInt (kids [i]);
			seen.addElement (kids [i]);

			USB	bus = (USB) busses.get (kids [i]);

			// new bus?
			if (bus == null) {
			    mkBus (kids [i], busnum);
			    changed = true;

			// new bus, but we missed a removal?

			// FIXME:  we can't tell from here!!

			// the same bus as last time?
			} else {
			    while (bus.scanBus ())
				changed = true;
			}

		    } catch (IOException e) {
			System.err.println ("I/O problem: " + kids [i]);
			e.printStackTrace ();

		    } catch (SecurityException e) {
			throw e;

		    } catch (Exception e) {
			// Special:  "devices", "drivers", ...
			if ("devices".equals (kids [i]))
			    continue;
			if ("drivers".equals (kids [i]))
			    continue;

			// excuuuse me??? 
			System.err.println ("Not a usbdevfs bus: "
				+ kids [i]);
			e.printStackTrace ();
		    }
		}

		// what busses previously existed ... but don't now?
		for (Enumeration e = busses.keys ();
			e.hasMoreElements ();
			) {
		    Object busname = e.nextElement ();
		    if (!seen.contains (busname)) {
			if (trace)
			    System.err.println ("bus gone: " + busname);
			rmBus (busname);
			changed = true;
		    }
		}
		
		// we saw all changes before lastTime
		lastTime = current;
	    }

	    // if changed, bus may not have quiesced yet
	    return changed;
	}

	private void rmBus (Object busname)
	{
	    USB	bus = (USB) busses.get (busname);

	    if (trace)
		System.err.println ("rmBus " + bus);

	    for (int i = 0; i < listeners.size (); i++) {
		USBListener	listener;
		listener = (USBListener) listeners.elementAt (i);
		try { listener.busRemoved (bus); }
		catch (Exception e) {
		    e.printStackTrace ();
		}
	    }

	    busses.remove (busname);
	    bus.kill ();
	}
	
	private void mkBus (String busname, int busnum)
	throws IOException, SecurityException
	{
	    USB	bus;

	    bus = new USB (dir, busname, busnum, listeners, self);
	    if (trace)
		System.err.println ("mkBus " + bus);

	    busses.put (busname, bus);
	    for (int i = 0; i < listeners.size (); i++) {
		USBListener	listener;
		listener = (USBListener) listeners.elementAt (i);
		try { listener.busAdded (bus); }
		catch (Exception e) {
		    e.printStackTrace ();
		}
	    }
	    
	    while (bus.scanBus ())
		continue;
	}
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产视频在线| 丝袜a∨在线一区二区三区不卡 | 日本女人一区二区三区| 亚洲免费成人av| 久久精品日韩一区二区三区| 91精品国产综合久久久久久久久久 | 欧美视频一区二区三区在线观看| 精品一区二区在线看| 亚洲 欧美综合在线网络| 亚洲免费观看高清在线观看| 国产精品美女久久久久aⅴ | 蜜桃视频一区二区三区| 亚洲精选在线视频| 亚洲欧美电影一区二区| 亚洲视频一区二区免费在线观看| 亚洲国产精品黑人久久久| 国产精品全国免费观看高清| 中文字幕第一页久久| 亚洲欧洲日韩女同| 亚洲激情网站免费观看| 亚洲自拍偷拍图区| 免费看黄色91| 黄色小说综合网站| 国产99久久久国产精品| 国产精品资源在线看| 国产成人在线看| 99精品国产99久久久久久白柏| 成人国产精品免费网站| 91在线视频免费91| 欧美日韩国产综合一区二区| 日韩西西人体444www| 久久九九久久九九| 日韩美女视频19| 日韩精品每日更新| 成人小视频在线| 欧美色图免费看| 久久久午夜精品理论片中文字幕| 中文字幕二三区不卡| 国产成人av在线影院| 成人看片黄a免费看在线| 欧洲在线/亚洲| 久久久久久一二三区| 亚洲蜜桃精久久久久久久| 日韩中文字幕区一区有砖一区 | 日韩精品乱码av一区二区| 国内成人精品2018免费看| 99九九99九九九视频精品| 欧美另类一区二区三区| 国产日韩精品视频一区| 亚欧色一区w666天堂| 成人免费毛片片v| 在线电影欧美成精品| 国产精品美女www爽爽爽| 免费在线看一区| 91视视频在线观看入口直接观看www | 国产精品亲子伦对白| 天天综合网 天天综合色| 成人涩涩免费视频| 91精品国产欧美一区二区成人| 国产精品久久久久婷婷| 人禽交欧美网站| 欧美性猛交xxxx黑人交| 国产精品二区一区二区aⅴ污介绍| 午夜欧美在线一二页| 成人精品国产福利| 久久亚洲免费视频| 精品一区二区三区影院在线午夜| 欧美色涩在线第一页| 亚洲免费看黄网站| 一本一道综合狠狠老| 中文字幕一区二区三中文字幕| 国产精品羞羞答答xxdd| 欧美精品一区男女天堂| 美女视频黄 久久| 这里只有精品视频在线观看| 亚洲一二三四区| 欧美性猛交xxxxxx富婆| 亚洲bdsm女犯bdsm网站| 色噜噜狠狠一区二区三区果冻| 1区2区3区国产精品| 91亚洲精品久久久蜜桃| 一区二区三区久久久| 日本久久一区二区| 亚洲一区二区三区四区在线免费观看 | 欧美日韩一区小说| 午夜国产不卡在线观看视频| 欧日韩精品视频| 亚洲成人一二三| 日韩午夜在线观看视频| 精品一区二区在线免费观看| 久久免费偷拍视频| 成人免费观看视频| 一区二区三区视频在线观看| 欧美系列一区二区| 日韩国产欧美三级| 欧美不卡激情三级在线观看| 国产精品白丝jk黑袜喷水| 中文字幕在线观看不卡| 日本高清成人免费播放| 亚洲成人综合在线| 欧美大片一区二区三区| 夫妻av一区二区| 亚洲成av人片在线观看| 精品国产乱码91久久久久久网站| 成人夜色视频网站在线观看| 日韩精品一二三区| 国产精品资源在线看| 久久综合色8888| 欧美系列一区二区| 一本大道av一区二区在线播放| 久久国产精品99久久久久久老狼| 久久美女高清视频| 欧美视频一区二区三区在线观看| 老司机精品视频导航| 亚洲美女视频一区| 精品国产制服丝袜高跟| 欧美性一二三区| 国产成人在线色| 亚洲www啪成人一区二区麻豆| 久久久蜜桃精品| 在线播放91灌醉迷j高跟美女 | 欧美日本一区二区三区四区| 丁香桃色午夜亚洲一区二区三区| 亚洲综合免费观看高清完整版| 久久久久久久久一| 欧美一区二区精品久久911| 91在线观看下载| 成人美女在线视频| 成人一区在线观看| 国产精品亚洲成人| 精品中文av资源站在线观看| 日韩欧美激情在线| 日韩精品中文字幕在线不卡尤物| 2023国产精华国产精品| 久久久久久夜精品精品免费| 国产午夜三级一区二区三| 国产亚洲欧洲997久久综合 | 欧美日韩另类一区| 欧美视频在线一区二区三区 | 久久精品欧美日韩精品| 国产日韩成人精品| 国产色91在线| 日韩码欧中文字| 亚洲一区在线免费观看| 亚洲午夜一二三区视频| 亚洲自拍偷拍图区| 偷拍亚洲欧洲综合| 免费在线观看一区二区三区| 国产在线看一区| 北岛玲一区二区三区四区| 99久久综合狠狠综合久久| 色视频一区二区| 91精品国产色综合久久| 精品理论电影在线| 国产精品国产馆在线真实露脸| 亚洲美女免费在线| 日韩二区三区四区| 精品一区二区三区在线视频| 国产 日韩 欧美大片| 色婷婷狠狠综合| 337p日本欧洲亚洲大胆色噜噜| 中文字幕欧美日本乱码一线二线 | 国产在线播放一区二区三区| 一本久久a久久免费精品不卡| 日韩免费一区二区| 一区二区免费看| 亚洲成av人**亚洲成av**| 日韩av一区二区三区| 国内精品免费**视频| 91影视在线播放| 日韩一区二区三区视频| 国产精品网站在线播放| 亚洲午夜免费福利视频| 精品一区二区日韩| 91蜜桃免费观看视频| 欧美大片在线观看一区| 综合在线观看色| 精品一区二区三区在线观看国产| 97久久精品人人做人人爽| 日韩区在线观看| 亚洲国产裸拍裸体视频在线观看乱了| 毛片基地黄久久久久久天堂| 9l国产精品久久久久麻豆| 91精品国产福利在线观看| 国产精品视频一二三| 日韩国产一二三区| 色综合久久久久网| 久久久久久久久久久久久夜| 天堂在线一区二区| 91免费国产在线| 国产精品不卡在线| 国产成人三级在线观看| 在线播放一区二区三区| 亚洲欧洲在线观看av| 国产激情视频一区二区三区欧美| 欧美一区二区三区四区视频| 亚洲乱码日产精品bd| 91农村精品一区二区在线| 亚洲国产激情av| 国产成人综合亚洲网站|