• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DescriptorUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.usb4java.DescriptorUtils的典型用法代码示例。如果您正苦于以下问题:Java DescriptorUtils类的具体用法?Java DescriptorUtils怎么用?Java DescriptorUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DescriptorUtils类属于org.usb4java包,在下文中一共展示了DescriptorUtils类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: toString

import org.usb4java.DescriptorUtils; //导入依赖的package包/类
@Override
public String toString()
{
    return String.format(
        "Interface Descriptor:%n" +
        "  bLength %18d%n" +
        "  bDescriptorType %10d%n" +
        "  bInterfaceNumber %9d%n" +
        "  bAlternateSetting %8d%n" +
        "  bNumEndpoints %12d%n" +
        "  bInterfaceClass %10d %s%n" +
        "  bInterfaceSubClass %7d%n" +
        "  bInterfaceProtocol %7d%n" +
        "  iInterface %15d%n",
        bLength() & 0xff,
        bDescriptorType() & 0xff,
        bInterfaceNumber() & 0xff,
        bAlternateSetting() & 0xff,
        bNumEndpoints() & 0xff,
        bInterfaceClass() & 0xff,
        DescriptorUtils.getUSBClassName(bInterfaceClass()),
        bInterfaceSubClass() & 0xff,
        bInterfaceProtocol() & 0xff,
        iInterface() & 0xff);
}
 
开发者ID:usb4java,项目名称:usb4java-javax,代码行数:26,代码来源:SimpleUsbInterfaceDescriptor.java


示例2: toString

import org.usb4java.DescriptorUtils; //导入依赖的package包/类
@Override
public String toString()
{
    return String.format(
        "Endpoint Descriptor:%n" +
        "  bLength %18d%n" +
        "  bDescriptorType %10d%n" +
        "  bEndpointAddress %9s  EP %d %s%n" +
        "  bmAttributes %13d%n" +
        "    Transfer Type             %s%n" +
        "    Synch Type                %s%n" +
        "    Usage Type                %s%n" +
        "  wMaxPacketSize %11d%n" +
        "  bInterval %16d%n",
        bLength() & 0xff,
        bDescriptorType() & 0xff,
        String.format("0x%02x", bEndpointAddress() & 0xff),
        bEndpointAddress() & 0x0f,
        DescriptorUtils.getDirectionName(bEndpointAddress()),
        bmAttributes() & 0xff,
        DescriptorUtils.getTransferTypeName(bmAttributes()),
        DescriptorUtils.getSynchTypeName(bmAttributes()),
        DescriptorUtils.getUsageTypeName(bmAttributes()),
        wMaxPacketSize() & 0xffff,
        bInterval() & 0xff);
}
 
开发者ID:usb4java,项目名称:usb4java-javax,代码行数:27,代码来源:SimpleUsbEndpointDescriptor.java


示例3: fullDescription

import org.usb4java.DescriptorUtils; //导入依赖的package包/类
public String fullDescription() {
	getStringDescriptors();

	final StringBuilder desc = new StringBuilder();

	desc.append(String.format("%s%n", toString()));
	desc.append(String.format("Device VID: %04X, PID: %04X%n", devVID & 0xFFFF, devPID & 0xFFFF));
	desc.append(String.format("Device Speed: %s%n", DescriptorUtils.getSpeedName(LibUsb.getDeviceSpeed(dev))));
	desc.append(DescriptorUtils.dump(devDesc, devManufacturer, devProduct, devSerialNumber));

	return (desc.toString());
}
 
开发者ID:inilabs,项目名称:flashy,代码行数:13,代码来源:UsbDevice.java


示例4: toString

import org.usb4java.DescriptorUtils; //导入依赖的package包/类
@Override
public String toString()
{
    return String.format(
        "Device Descriptor:%n" +
        "  bLength %18d%n" +
        "  bDescriptorType %10d%n" +
        "  bcdUSB %19s%n" +
        "  bDeviceClass %13d %s%n" +
        "  bDeviceSubClass %10d%n" +
        "  bDeviceProtocol %10d%n" +
        "  bMaxPacketSize0 %10d%n" +
        "  idVendor %17s%n" +
        "  idProduct %16s%n" +
        "  bcdDevice %16s%n" +
        "  iManufacturer %12d%n" +
        "  iProduct %17d%n" +
        "  iSerial %18d%n" +
        "  bNumConfigurations %7d%n",
        bLength() & 0xff,
        bDescriptorType() & 0xff,
        DescriptorUtils.decodeBCD(bcdUSB()),
        bDeviceClass() & 0xff,
        DescriptorUtils.getUSBClassName(bDeviceClass()),
        bDeviceSubClass() & 0xff,
        bDeviceProtocol() & 0xff,
        bMaxPacketSize0() & 0xff,
        String.format("0x%04x", idVendor() & 0xffff),
        String.format("0x%04x", idProduct() & 0xffff),
        DescriptorUtils.decodeBCD(bcdDevice()),
        iManufacturer() & 0xff,
        iProduct() & 0xff,
        iSerialNumber() & 0xff,
        bNumConfigurations() & 0xff);
}
 
开发者ID:usb4java,项目名称:usb4java-javax,代码行数:36,代码来源:SimpleUsbDeviceDescriptor.java


示例5: dumpDevice

import org.usb4java.DescriptorUtils; //导入依赖的package包/类
/**
 * Dumps the specified device to stdout.
 * 
 * @param device
 *            The device to dump.
 */
public static void dumpDevice(final Device device)
{
    // Dump device address and bus number
    final int address = LibUsb.getDeviceAddress(device);
    final int busNumber = LibUsb.getBusNumber(device);
    System.out.println(String
        .format("Device %03d/%03d", busNumber, address));

    // Dump port number if available
    final int portNumber = LibUsb.getPortNumber(device);
    if (portNumber != 0)
        System.out.println("Connected to port: " + portNumber);

    // Dump parent device if available
    final Device parent = LibUsb.getParent(device);
    if (parent != null)
    {
        final int parentAddress = LibUsb.getDeviceAddress(parent);
        final int parentBusNumber = LibUsb.getBusNumber(parent);
        System.out.println(String.format("Parent: %03d/%03d",
            parentBusNumber, parentAddress));
    }

    // Dump the device speed
    System.out.println("Speed: "
        + DescriptorUtils.getSpeedName(LibUsb.getDeviceSpeed(device)));

    // Read the device descriptor
    final DeviceDescriptor descriptor = new DeviceDescriptor();
    int result = LibUsb.getDeviceDescriptor(device, descriptor);
    if (result < 0)
    {
        throw new LibUsbException("Unable to read device descriptor",
            result);
    }

    // Try to open the device. This may fail because user has no
    // permission to communicate with the device. This is not
    // important for the dumps, we are just not able to resolve string
    // descriptor numbers to strings in the descriptor dumps.
    DeviceHandle handle = new DeviceHandle();
    result = LibUsb.open(device, handle);
    if (result < 0)
    {
        System.out.println(String.format("Unable to open device: %s. "
            + "Continuing without device handle.",
            LibUsb.strError(result)));
        handle = null;
    }

    // Dump the device descriptor
    System.out.print(descriptor.dump(handle));

    // Dump all configuration descriptors
    dumpConfigurationDescriptors(device, descriptor.bNumConfigurations());

    // Close the device if it was opened
    if (handle != null)
    {
        LibUsb.close(handle);
    }
}
 
开发者ID:usb4java,项目名称:usb4java-examples,代码行数:69,代码来源:DumpDevices.java



注:本文中的org.usb4java.DescriptorUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ErrorParserManager类代码示例发布时间:2022-05-16
下一篇:
Java NodeList类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap