精华内容
下载资源
问答
  • 以下是USB所有支持的设备类型代码. 地址:http://www.usb.org/developers/defined_class USB Class Codes November 17, 2009 USB defines class code information that is used to identify a devi...

    以下是相关类型的详细说明:

    地址:https://www.usb.org/documents

    搜索device class

    以下是USB所有支持的设备类型代码.

    地址:http://www.usb.org/developers/defined_class

    USB Class Codes                    

    November 17, 2009


    USB defines class code information that is used to identify a device’s functionality and to nominally load a device driver based on that functionality. The information is contained in three bytes with the names Base Class, SubClass, and Protocol. (Note that ‘Base Class’ is used in this description to identify the first byte of the Class Code triple. That terminology is not used in the USB Specification). There are two places on a device where class code information can be placed.One place is in the Device Descriptor, and the other is in Interface Descriptors. Some defined class codes are allowed to be used only in a Device Descriptor, others can be used in both Device and Interface Descriptors, and some can only be used in Interface Descriptors. The table below shows the currently defined set of  Base Class values, what the generic usage is, and where that Base Class can be used (either Device or Interface Descriptors or both).

     

     

    Base Class

    Descriptor Usage

    Description

    00h

    Device

    Use class information in the Interface Descriptors

    01h

    Interface

    Audio  

    02h

    Both

    Communications and CDC Control

    03h

    Interface

    HID (Human Interface Device)

    05h

    Interface

    Physical

    06h

    Interface

    Image

    07h

    Interface

    Printer

    08h

    Interface

    Mass Storage

    09h

    Device

    Hub

    0Ah

    Interface

    CDC-Data

    0Bh

    Interface

    Smart Card

    0Dh

    Interface

    Content Security

    0Eh

    Interface

    Video

    0Fh

    Interface

    Personal Healthcare

    DCh

    Both

    Diagnostic Device

    E0h

    Interface

    Wireless Controller

    EFh

    Both

    Miscellaneous

    FEh

    Interface

    Application Specific

    FFh

    Both

    Vendor Specific

     

     


    Base Class 00h (Device)

    This base class is defined to be used in Device Descriptors to indicate that class information should be determined from the Interface Descriptors in the device. There is one class code definition in this base class.  All other values are reserved.

     

    This value is also used in Interface Descriptors to indicate a null class code triple.

     

     

    Base Class

    SubClass

    Protocol

    Meaning

    00h

    00h

    00h

    Use class code info from Interface Descriptors

     

     


    Base Class 01h (Audio)

    This base class is defined for Audio capable devices that conform to the Audio Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes may only be used in Interface Descriptors.

     

     

    Base Class

    SubClass

    Protocol

    Meaning

    01h

    xxh

    xxh

    Audio device

     

     

    Base Class 02h (Communications and CDC Control)

     

    This base class is defined for devices that conform to the Communications Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved.  Note that the Communication Device Class spec requires some class code values (triples) to be used in Device Descriptors and some to be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    02h

    xxh

    xxh

    Communication device class

     

    Base Class 03h (HID – Human Interface Device)

    This base class is defined for devices that conform to the HID Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.   Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    03h

    xxh

    xxh

    HID device class

     

    Base Class 05h (Physical)

    This base class is defined for devices that conform to the Physical Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.  Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    05h

    xxh

    xxh

    Physical device class

     

     

    Base Class 06h (Still Imaging)

    This base class is defined for devices that conform to the Imaging Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.   Values outside of that defined spec are reserved.

     

    Base Class

    SubClass

    Protocol

    Meaning

    06h

    01h

    01h

    Still Imaging device

     

     

    Base Class 07h (Printer)

    This base class is defined for devices that conform to the Printer Device Class Specification found on the USB-IF website.  That specification defines the usable set of SubClass and Protocol values.  Values outside of that defined spec are reserved.  These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    07h

    xxh

    xxh

    Printer device

     

     

    Base Class 08h (Mass Storage)

    This base class is defined for devices that conform to the Mass Storage Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    08h

    xxh

    xxh

    Mass Storage device

     

     

    Base Class 09h (Hub)

    This base class is defined for devices that are USB hubs and conform to the definition in the USB specification.  That specification defines the complete triples as shown below.  All other values are reserved.  These class codes can only be used in Device Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    09h

    00h

    00h

    Full speed Hub

    01h

    Hi-speed hub with single TT

    02h

    Hi-speed hub with multiple TTs

     

     

    Base Class 0Ah (CDC-Data)

    This base class is defined for devices that conform to the Communications Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    0Ah

    xxh

    xxh

    CDC data device

     

     

    Base Class 0Bh (Smart Card)

    This base class is defined for devices that conform to the Smart Card Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    0Bh

    xxh

    xxh

    Smart Card device

     

     

    Base Class 0Dh (Content Security)

    This base class is defined for devices that conform to the Content Security Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    0Dh

    00h

    00h

    Content Security device

     

     

    Base Class 0Eh (Video)

    This base class is defined for devices that conform to the Video Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    0Eh

    xxh

    xxh

    Video device

     

     

    Base Class 0Fh (Personal Healthcare)

    This base class is defined for devices that conform to the Personal Healthcare Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes should only be used in Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    0Fh

    xxh

    xxh

    Personal Healthcare device

     

     

    Base Class DCh (Diagnostic Device)

    This base class is defined for devices that diagnostic devices. There is currently only one value defined. All other values are reserved. This class code can be used in Device or Interface Descriptors.

     

    Base Class

    SubClass

    Protocol

    Meaning

    DCh

    01h

    01h

    USB2 Compliance Device.  Definition for this device can be found at http://www.intel.com/technology/usb/spec.htm

     

     

    Base Class E0h (Wireless Controller)

    This base class is defined for devices that are Wireless controllers. Values not shown in the table below are reserved. These class codes are to be used in Interface Descriptors, with the exception of the Bluetooth class code which can also be used in a Device Descriptor.

     

     

    Base Class

    SubClass

    Protocol

    Meaning

    E0h

    01h

    01h

    Bluetooth Programming Interface.  Get specific information from www.bluetooth.com.

    02h

    UWB Radio Control Interface.  Definition for this is found in the Wireless USB Specification in Chapter 8.

    03h

    Remote NDIS.  Information can be found at: http://www.microsoft.com/windowsmobile/mobileoperators/default.mspx

    04h

     

    Bluetooth AMP Controller. Get specific information from www.bluetooth.com.

    2h

    01h

    Host Wire Adapter Control/Data interface.  Definition can be found in the Wireless USB Specification in Chapter 8.

    02h

    Device Wire Adapter Control/Data interface.  Definition can be found in the Wireless USB Specification in Chapter 8.

    03h

    Device Wire Adapter Isochronous interface.  Definition can be found in the Wireless USB Specification in Chapter 8.

     

    Base Class EFh (Miscellaneous)

    This base class is defined for miscellaneous device definitions. Values not shown in the table below are reserved.  The use of these class codes (Device or Interface descriptor) are specifically annotated in each entry below.

     

     

    Base Class

    SubClass

    Protocol

    Meaning

    EFh

    01h

    01h

    Active Sync device.  This class code can be used in either Device or Interface Descriptors.  Contact Microsoft for more information on this class.

    02h

    Palm Sync.  This class code can be used in either Device or Interface Descriptors.

    02h

    01h

    Interface Association Descriptor.  The usage of this class code triple is defined in the Interface Association Descriptor ECN that is provided on www.usb.org .  This class code may only be used in Device Descriptors.

    02h

    Wire Adapter Multifunction Peripheral programming interface. Definition can be found in the Wireless USB Specification in Chapter 8.  This class code may only be used in Device Descriptors

    03h

    01h

    Cable Based Association Framework.  This is defined in the Association Model addendum to the Wireless USB specification.  This class code may only be used in Interface Descriptors.

     

     

     

    Base Class FEh (Application Specific)

    This base class is defined for devices that conform to several class specifications found on the USB-IF website.  That specification defines the usable set of SubClass and Protocol values.  Values outside of that defined spec are reserved.  These class codes can only be used in Interface Descriptors.

     

     

    Base Class

    SubClass

    Protocol

    Meaning

    FEh

    01h

    01h

    Device Firmware Upgrade.  Device class definition provided on www.usb.org .

    02h

    00h

    IRDA Bridge device.  Device class definition provided on www.usb.org .

    03h

    00h

    USB Test and Measurement Device.  Definition provided in the USB Test and Measurement Class spec found on www.usb.org .

    01h

    USB Test and Measurement Device conforming to the USBTMC USB488 Subclass Specification found on www.usb.org.

     

     

    Base Class FFh (Vendor Specific)

    This base class is defined for vendors to use as they please.  These class codes can be used in both Device and Interface Descriptors.

     

     

    Base Class

    SubClass

    Protocol

    Meaning

    FFh

    xxh

    xxh

    Vendor specific

     

     

    以下是相关类型的详细说明:

    地址:http://www.usb.org/developers/devclass_docs

    Approved Class Specification Documents 

     

    If you have questions regarding any of these documents please contact the DWG chair (dwg-wg-chair@usb.org) and your questions will be channeled to the appropriate group.

    Audio Class

    Audio Device Class Spec for Basic Audio Devices and Adopters Agreement (.zip format, size 1.33MB)
    Audio Device Document 1.0
    Audio Data Formats 1.0
    Audio Terminal Types 1.0
    USB MIDI Devices 1.0
    Audio Devices Rev. 2.0 Spec and Adopters Agreement (.zip format, size 1.28MB) 

    Battery Charging

    Battery Charging v1.1 Spec and Adopters Agreement (.zip format, size 292 KB)

    Cable and Connector

    Cable and Connector Class 2.0 
    Series 'A' Plug form factor Guideline 1.0
    USB Connector for Mezzanine Applications Guidelines Rev. 1.0
    Micro-USB Cables and Connectors v1.01 Spec and Adopters Agreement

    Common Class (CCS)

    Common Class Base Specification 1.0

    Communications Device Class

    Class definitions for Communication Devices 1.2 (.zip file format, size 2.61 MB)
    the components of CDC 1.1 have been reorganized as five separate documents:
    ATM120.pdf -- CDC Subclass for Asynchronous Transfer Mode Devices
    CDC120.pdf -- CDC Subclass for Communications Devices
    ECM120.pdf -- CDC Subclass for Ethernet Control Model Devices
    ISDN120.pdf -- CDC Subclass for ISDN Devices
    PSTN120.pdf -- CDC Subclass for PSTN devices
    CDC Subclass for Wireless Mobile Communication Devices 1.1
    CDC v1.2 WMC v1.1 Adopters Agreement


    CDC Subclass Specification for Ethernet Emulation Model Devices 1.0

    Network Control Model Devices Specification v1.0 and Adopters Agreement (.zip format, size 492 KB)

    Content Security

    Device Class Definition for Content Security Devices 1.0
    Content Security Method 1 - Basic Authentication Protocol 1.0
    Content Security Method 2 - USB Digital Transmission Content Protection Implementation 1.0

    Device Firmware Upgrade Group

    Device Firmware Upgrade 1.1 (new version 31-Aug-2004)

    HID Class

    HID Information

    Imaging Class

    Still Image Capture Device Definition 1.0 and Errata as of 16-Mar-2007 (.zip format, size 200 KB)

    IrDA

    IrDA Bridge Device Definition 1.0

    Mass Storage

    Mass Storage Class Specification Overview 1.3
    Mass Storage Bulk Only 1.0
    Mass Storage Control/Bulk/Interrupt (CBI) Specification 1.1  
    Mass Storage UFI Command Specification 1.0
    Mass Storage Bootability Specification 1.0
    Lockable Mass Storage Specification 1.0 and Adopters Agreement (.zip format, size 288 KB)
      - Lockable Mass Storage IP Disclosure

    Media Transfer Protocol

    Media Transfer Protocol v.1.0 Spec and MTP v.1.0 Adopters Agreement (.zip format, size 1.86MB)

    Monitor

    Monitor Device Document 1.0

    OpenUSBDI

    OpenUSBDI Specification 1.0

    Personal Healthcare

    Personal Healthcare Rev. 1.0, Errata for USB Personal Health Care Device Class and Personal Healthcare Adopters Agreement (.zip format, size 386 KB)

    Physical Interface Devices

    Device Class Definition for PID 1.0

    Power

    Power Device Class Document 1.0

    Printer Class

    Printer Device Class Document 1.1

    Smart Card Class

    Smart Card CCID version 1.1
    Smart Card ICCD version 1.0 
     

    Test & Measurement Class

    Test & Measurement Class Specifications

    Video Class

    Video Class 1.1 document set
        USB_Video_Class_1.1
        USB_Video_Identifiers_1.1
        USB_Video_Payload_DV_1.1
        USB_Video_Payload_Frame_Based_1.1
        USB_Video_Payload_MJPEG_1.1
        USB_Video_Payload_MPEG-2_TS_1.1
        USB_Video_Payload_Uncompressed_1.1
        USB_Video_Payload_Stream_Based_1.1
        USB_Video_Transport_1.1
        USB_Video_Example_1.1
        USB_Video_FAQ_1.1

    Draft Class Specification Documents

    PC Legacy Compatibility Specification 0.9

    USB_Video_Compliance_1.09b -- draft for public review


     

    下面是我的个人微信公众号,关注【一个早起的程序员】精彩系列文章每天不断。

     

    展开全文
  • 自己写的禁用USB的小程序,实现很简单,关键是Inf文件的修改
  • bc28拨号驱动代码

    2020-04-08 17:57:40
    BC28的状态机拨号流程,可以参考学习,参考移远的BC28的NB模组的3GPP协议,加上简单的操作系统写的
  • usbserialcontroller驱动是支持WIN7旗舰版64位的USB转串口驱动,需要的朋友欢迎下载!安装说明1.手动安装插入数据线,查找到新硬件,然后将其需要的配置文件定位到这里2.自动安装运行Setup.exe安装成功后重新启动...
  • usb-serialcontrollerd驱动是一个的usb转com口驱动程序。本软件可以帮助用户实现usb和com串口之间的转换连接。为了方便网友们正确安装使用,小编提供了详细的安装操作教程。快来下载使用吧!软件介绍usb?...
  • usb2.0-serial驱动下载

    2019-02-18 23:20:12
    笔记本+win7下USB2.0转串口驱动的安装
  • usb-blaster

    2019-04-07 12:57:29
    FPGA quartus 15.0 win10环境下的USB-BALSTER驱动亲测可用,不懂得可以私信
  • 1、故障现象 在给单位的一台Server2008R2 X64服务器上安装扫描枪的时候发现...(代码 28)”,就是安装驱动程序有错,但是具体是什么错误,我们从这里是无法得到的。如果以错误提示或者错误代码为关键字上网搜索...

    1、故障现象

           在给单位的一台Server2008R2 X64服务器上安装扫描枪的时候发现无法安装扫描枪驱动,打开设备管理器可以看到扫描枪硬件有黄色叹号标记。错误信息如下:

            Windows给出的错误提示很简单,“该设备的驱动程序未被安装。(代码 28)”,就是安装驱动程序有错,但是具体是什么错误,我们从这里是无法得到的。如果以错误提示或者错误代码为关键字上网搜索的话,相信我你一定得不到太多有用的信息。因为之前另外一台win7x64上安装这个扫描枪驱动是没问题的,所以我知道问题不在驱动本身或者硬件设备上。一开始以为是操作系统版本问题,但08r2和win7本来就是差不多的,绕了一些弯路后,还是决定从错误的根源上找原因。

     2、问题分析

          上网搜索后,知道驱动安装会生成系统日志保持在C:\Windows\inf\setupapi.dev.log\setupapi.dev.log中。打开这个日志找到相关日志信息再来分析问题就非常简单了。这是一个非常值得学习的小技巧,log日志远比图形界面提供的错误信息完整并且更有指导意义。如下是setupapi.dev.log中驱动安装时的相关错误信息节选:

         inf:           Opened INF: 'c:\windows\temp\dmiwu\{de4ae465-6949-463b-9822-287a65fb2b68}\nls_vcp_driver.inf' ([strings])
    !    inf:           Could not find include INF file "layout.inf". Error = 0x00000002
    !    inf:           Unable to load INF: 'C:\Windows\System32\DriverStore\FileRepository\mdmcpq.inf_amd64_neutral_b53453733bd795bc\mdmcpq.inf'(00000003)
    !    inf:           Error 3: The system cannot find the path specified.
    !    inf:           Could not find include INF file "mdmcpq.inf". Error = 0x00000003

           相比设备管理器提供的错误信息,这里的日志足够清楚了,安装驱动的时候因为打不开mdmcpq.inf文件所以驱动安装无法继续报错了。上面一行的layout.inf文件经过分析上下文是不影响安装进行的,重要的还是缺少mdmcpq这个东西。找到驱动的安装目录,在这个扫描枪驱动的inf文件中有如下行:

    [VCP_DriverInstall.NT]
    Include=mdmcpq.inf
    CopyFiles=FakeModemCopyFileSection
    AddReg=VCP_DriverInstall.NT.AddReg

    扫描枪的驱动在安装过程中会用到mdmcpq.inf文件,但是安装时候找不到这个文件,所以出错了。

    3、解决方法

           原因找到了缺少依赖驱动,修复就行了,上网直接搜吧,很容易找到一堆关于mdmcpq缺失的问题。同时也会搜到一些无效的方法,比如复制原版的mdmcpq.inf 和 usbser.sys到system32的inf和drivers目录。

           但是从日志很明显知道驱动查找的是C:\Windows\System32\DriverStore\FileRepository\目录。所以最好的方法还是从正常的系统中直接复制C:\Windows\System32\DriverStore\FileRepository\mdmcpq.inf_amd64_neutral_b53453733bd795bc目录到故障系统的同位置目录下,如果复制时提示文件夹没有访问权限,给FileRepository目录增加用户权限就行了。

    我这里出现故障的系统版本是非原版系统,作者也是小有名气的。但在修改系统过程中难免出现一些隐藏的问题,这种隐藏比较深的故障,对于普通用户来说确实是很难解决的问题。这里非常值得注意的是驱动安装日志用于分析问题的方法,图形化界面虽然友好,但在分析故障原因上有时候的提示太过简化反而变得毫无意义。

     

     

     

    展开全文
  • usb2.0_ser!_USB转串口的驱动程序,win10、win8、win7驱动程序。 usb2.0_ser!_USB转串口的驱动程序
  • 霍尼韦尔honeywell1900扫描枪的USB驱动,就是扫描枪usb转com。安装说明:解压后再安装,如果你的系统是32位的,就直接运行Install_x86.bat,如果是64位的,就运行Install_x64.bat。驱动文件:acmfccoi_21617....
  • 固件#01--USB转I2C底层代码和原理

    千次阅读 2017-08-24 15:50:39
    USB转I2C底层代码和原理。

    I2C

    简介

    I2C总线是由Philips公司开发的一种简单、双向二线制同步串行总线。SDA(串行数据线)和SCL(串行时钟线)都是双向I/O线,接口电路为开漏输出.需通过上拉电阻接电源VCC.

    I2C(内部集成电路)总线接口处理微控制器与串行 I2C 总线间的通信。它提供多主模式功
    能,可以控制所有 I2C 总线特定的序列、协议、仲裁和时序。它支持标准模式 (Sm)、快速模
    式 (Fm) 和超快速模式 (Fm+)。

    • 从模式和主模式
    • 多主模式功能
    • 标准速度模式(高达 100 kHz)
    • 快速模式(高达 400 kHz)
    • 超快速模式(高达 1 MHz)
    • 7 位和 10 位寻址模式

    I2C start/stop

    • 开始信号:SCL为高电平时,SDA由高电平向低电平跳变,开始传送数据。
    • 结束信号:SCL为高电平时,SDA由低电平向高电平跳变,结束传送数据。

    I2C read

    1. Master发送I2C addr(7bit)和w操作0(1bit),等待ACK
    2. Slave发送ACK
    3. Master发送reg addr(8bit),等待ACK
    4. Slave发送ACK
    5. Master发起START
    6. Master发送I2C addr(7bit)和r操作1(1bit),等待ACK
    7. Slave发送ACK
    8. Slave发送data(8bit),即寄存器里的值
    9. Master发送ACK。或者Master发送NACK,要求结束。
    10. 第8步和第9步可以重复多次,即顺序读多个寄存器

    I2C write

    1. Master发起START
    2. Master发送I2C addr(7bit)和w操作0(1bit),等待ACK
    3. Slave发送ACK
    4. Master发送reg addr(8bit),等待ACK
    5. Slave发送ACK
    6. Master发送data(8bit),即要写入寄存器中的数据,等待ACK
    7. Slave发送ACK
    8. 第6步和第7步可以重复多次,即顺序写多个寄存器
    9. Master发起STOP

    例子

    I2C signal diagram: SDA(green) and SCL(yellow)

            write 0x55 DAC 
    

    USB to I2C

    通过USB虚拟串口实现PC与I2C设备进行通信。使用STM32L073xx MCU,硬件I2C和软件模拟I2C,用看门狗检测运行状态。

    底层firmware实现代码和硬件电路图见链接:

    USB安装成功:

    串口助手调试

    部分代码main.c

    
        #include "main.h"
        #include "stm32l0xx_hal.h"
        #include "usb_device.h"
        #include "i2c.h"
        #include "soft_i2c.h"
        #include "stm32l0xx_nucleo.h"
        #include "usbd_cdc_if.h"
        #include "modsel.h"
    
        /* Buffer used for transmission */
        //uint8_t aTxBuffer[] = {0x33, 0x34};
        //uint8_t aTxBuffer[] = {0x46, 0x54};//{"FT"}
        uint8_t aTxBuffer[RXBUFFERSIZE];
    
        /* Buffer used for reception */
        uint8_t aRxBuffer[RXBUFFERSIZE];
        __IO uint16_t hTxNumData = 0;
        __IO uint16_t hRxNumData = 0;
        uint8_t bTransferRequest = 0;
    
        /* USER CODE BEGIN Includes */
    
        /* USER CODE END Includes */
    
        /* Private variables ---------------------------------------------------------*/
        I2C_HandleTypeDef I2cHandle;
        IWDG_HandleTypeDef hiwdg;
    
        /* USER CODE BEGIN PV */
        /* Private variables ---------------------------------------------------------*/
    
        /* USER CODE END PV */
    
        /* Private function prototypes -----------------------------------------------*/
        void SystemClock_Config(void);
        static void MX_GPIO_Init(void);
        static void MX_IWDG_Init(void);
    
        /* USER CODE BEGIN PFP */
        /* Private function prototypes -----------------------------------------------*/
    
        /* USER CODE END PFP */
    
        /* USER CODE BEGIN 0 */
    
        /* USER CODE END 0 */
    
        int main(void)
        {
          /* USER CODE BEGIN 1 */
    
          /* USER CODE END 1 */
    
          /* MCU Configuration----------------------------------------------------------*/
    
          /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
          HAL_Init();
    
          /* USER CODE BEGIN Init */
    
          /* USER CODE END Init */
    
          /* Configure the system clock */
          SystemClock_Config();
    
          /* USER CODE BEGIN SysInit */
    
          /* USER CODE END SysInit */
    
          /* Initialize all configured peripherals */
          MX_GPIO_Init();
          MODSELL_Init();
          /* I2C2 init function */ 
        #ifdef HARDWARE_I2C  
          I2C_Init();  
        #else 
          Soft_I2C_Init();
        #endif /* HARDWARE_I2C */
    
          MX_IWDG_Init();
          MX_USB_DEVICE_Init();
    
          uint8_t len;
          uint8_t t;
          uint8_t deviceAddress;
          uint8_t regAddress;
          uint8_t length;
          uint8_t read_write;
    
        #ifdef HARDWARE_I2C
          while(1)
          {
            if(USB_USART_RX_STA&0x8000)
            {
              read_write = USB_USART_RX_Buffer[3];
              deviceAddress = USB_USART_RX_Buffer[4];
              regAddress = USB_USART_RX_Buffer[5];
              length = USB_USART_RX_Buffer[6];
    
              len = USB_USART_RX_STA&0x3FFF;
              USB_USART_RX_STA=0;
    
              for(t=0;t<len-8;t++)
              {
                aTxBuffer[t]=USB_USART_RX_Buffer[t+8];
              }
    
              if(read_write==MASTER_REQ_READ)
              {
                do
                {
                  if(HAL_I2C_Mem_Read_IT(&I2cHandle, (uint16_t)deviceAddress, regAddress, I2C_MEMADD_SIZE_8BIT, (uint8_t*)aRxBuffer, length)!= HAL_OK)
                  {
                    /* Error_Handler() function is called when error occurs. */
                    Error_Handler();
                  }          
                  while (HAL_I2C_GetState(&I2cHandle) != HAL_I2C_STATE_READY){}
                }
                while(HAL_I2C_GetError(&I2cHandle) == HAL_I2C_ERROR_AF);
    
                CDC_Transmit_FS(aRxBuffer, length);       
              }
    
              if(read_write==MASTER_REQ_WRITE)
              {
                do
                {
                  if(HAL_I2C_Mem_Write_IT(&I2cHandle, (uint16_t)deviceAddress, regAddress, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&aTxBuffer, len-8)!= HAL_OK)
                  {
                    /* Error_Handler() function is called when error occurs. */
                    Error_Handler();
                  }      
                  while (HAL_I2C_GetState(&I2cHandle) != HAL_I2C_STATE_READY){}
                }
                while(HAL_I2C_GetError(&I2cHandle) == HAL_I2C_ERROR_AF);
              }
            }   
    
    
            /* Refresh IWDG: reload counter */
            if(HAL_IWDG_Refresh(&hiwdg) != HAL_OK)
            {
              /* Refresh Error */
              Error_Handler();
            }
          }
        #else
        while(1)
          { 
            if(USB_USART_RX_STA&0x8000)
            { 
              read_write = USB_USART_RX_Buffer[3];
              deviceAddress = USB_USART_RX_Buffer[4];
              regAddress = USB_USART_RX_Buffer[5];
              length = USB_USART_RX_Buffer[6];
    
              len = USB_USART_RX_STA&0x3FFF;
              USB_USART_RX_STA=0;
    
              for(t=0;t<len-8;t++)
              {
                aTxBuffer[t]=USB_USART_RX_Buffer[t+8];
              }
    
              if(read_write==MASTER_REQ_READ)
              {        
                Soft_I2C_Read_Reg(deviceAddress, regAddress, aRxBuffer, length);       
                CDC_Transmit_FS(aRxBuffer, length);
              }  
    
              if(read_write==MASTER_REQ_WRITE)
              {  
                Soft_I2C_Send_Reg(deviceAddress, regAddress, aTxBuffer, len-8);
              }
            }
    
            /* Refresh IWDG: reload counter */
            if(HAL_IWDG_Refresh(&hiwdg) != HAL_OK)
            {
              /* Refresh Error */
              Error_Handler();
            }
          }
        #endif /* HARDWARE_I2C */
        }
    
        /** System Clock Configuration
        */
        void SystemClock_Config(void)
        {
          RCC_OscInitTypeDef RCC_OscInitStruct;
          RCC_ClkInitTypeDef RCC_ClkInitStruct;
          RCC_PeriphCLKInitTypeDef PeriphClkInit;
    
            /**Configure the main internal regulator output voltage 
            */
          __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
    
            /**Initializes the CPU, AHB and APB busses clocks 
            */
          RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSI48;
          RCC_OscInitStruct.HSIState = RCC_HSI_ON;
          RCC_OscInitStruct.HSICalibrationValue = 16;
          RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
          RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
          RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
          RCC_OscInitStruct.PLL.PLLMUL = RCC_PLLMUL_4;
          RCC_OscInitStruct.PLL.PLLDIV = RCC_PLLDIV_2;
          if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
          {
            _Error_Handler(__FILE__, __LINE__);
          }
    
            /**Initializes the CPU, AHB and APB busses clocks 
            */
          RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                                      |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
          RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
          RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
          RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
          RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
    
          if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
          {
            _Error_Handler(__FILE__, __LINE__);
          }
    
          PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
          PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
          if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
          {
            _Error_Handler(__FILE__, __LINE__);
          }
    
            /**Configure the Systick interrupt time 
            */
          HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
    
            /**Configure the Systick 
            */
          HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
    
          /* SysTick_IRQn interrupt configuration */
          HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
        }
    
    
    
        /** Pinout Configuration
        */
        static void MX_GPIO_Init(void)
        {
          /* GPIO Ports Clock Enable */
          //__HAL_RCC_GPIOB_CLK_ENABLE();
          __HAL_RCC_GPIOA_CLK_ENABLE();
        }
    
        static void MX_IWDG_Init(void)
        {
          hiwdg.Instance = IWDG;
          hiwdg.Init.Prescaler = IWDG_PRESCALER_64;
          hiwdg.Init.Window = 0xfff;
          hiwdg.Init.Reload = 0xfff;
          if (HAL_IWDG_Init(&hiwdg) != HAL_OK)
          {
            _Error_Handler(__FILE__, __LINE__);
          }
        }
    
        /**
          * @brief  This function is executed in case of error occurrence.
          * @param  None
          * @retval None
          */
        void _Error_Handler(char * file, int line)
        {
          /* USER CODE BEGIN Error_Handler_Debug */
          /* User can add his own implementation to report the HAL error return state */
          while(1) 
          {
          }
          /* USER CODE END Error_Handler_Debug */ 
        }
    
        #ifdef USE_FULL_ASSERT
    
        /**
           * @brief Reports the name of the source file and the source line number
           * where the assert_param error has occurred.
           * @param file: pointer to the source file name
           * @param line: assert_param error line source number
           * @retval None
           */
        void assert_failed(uint8_t* file, uint32_t line)
        {
          /* USER CODE BEGIN 6 */
          /* User can add his own implementation to report the file name and line number,
            ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
          /* USER CODE END 6 */
    
        }
        #endif
    展开全文
  • F28M35的USB通讯

    2015-01-07 20:41:51
    代码是F28M35的USB通讯源代码,已经调通
  • C#禁用USB的两种方法(附代码)

    千次阅读 2017-08-22 21:00:26
    方法一:通过修改注册表禁用USB    原理:只要把注册表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR路径下的Start值改成4即可禁用USB(默认为3,即允许USB)。  优点:简单易行。  缺点:...

    方法一:通过修改注册表禁用USB

     

          原理:只要把注册表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR路径下的Start值改成4即可禁用USB(默认为3,即允许USB)。

          优点:简单易行。

          缺点:地球人都知道,很容易识破。

          建议:用一个timer或者创建一个线程,来锁定这个值。

     

          程序代码:

    [csharp]  view plain  copy
     print ?
    1. using Microsoft.Win32;  
    2.   
    3. /// <summary>  
    4. /// 通过注册表启用USB  
    5. /// </summary>  
    6. /// <returns></returns>  
    7. public bool RegToRunUSB()   
    8. {  
    9.     try  
    10.     {  
    11.         RegistryKey regKey = Registry.LocalMachine; //读取注册列表HKEY_LOCAL_MACHINE  
    12.         string keyPath = @"SYSTEM\CurrentControlSet\Services\USBSTOR"//USB 大容量存储驱动程序  
    13.         RegistryKey openKey = regKey.OpenSubKey(keyPath, true);  
    14.         openKey.SetValue("Start", 3); //设置键值对(3)为开启USB(4)为关闭  
    15.         openKey.Close(); //关闭注册列表读写流  
    16.         return true;  
    17.     }  
    18.     catch (Exception ex)   
    19.     {  
    20.         throw ex;  
    21.     }  
    22. }  
    23.   
    24. /// <summary>  
    25. /// 通过注册表禁用USB  
    26. /// </summary>  
    27. /// <returns></returns>  
    28. public bool RegToStopUSB()   
    29. {  
    30.     try  
    31.     {  
    32.         RegistryKey regKey = Registry.LocalMachine;  
    33.         string keyPath = @"SYSTEM\CurrentControlSet\Services\USBSTOR";  
    34.         RegistryKey openKey = regKey.OpenSubKey(keyPath, true);  
    35.         openKey.SetValue("Start", 4);  
    36.         openKey.Close();  
    37.         return true;  
    38.     }  
    39.     catch (Exception ex)  
    40.     {  
    41.         throw ex;  
    42.     }  
    43. }  

    方法二:通过独占USB驱动文件禁用USB

     

          原理:如果U盘第一次在某个电脑上使用,电脑会自动安装该U盘的驱动信息,修改C:\Windows\inf\usbstor.inf和C:\Windows\inf\usbstor.PNF这两个文件。假如我们用C#程序以独占的形式打开他们,那么Windows便无法修改这两个文件,U盘驱动安装不上自然无法使用。

          优点:简单易行,不容易识破。

          缺点:只能禁用未在该电脑上使用过的U盘。

          建议:一定要注意独占的时候文件打开对象要用类的成员变量(也就是模块级变量),如果用局部变量,会自动被托管程序释放,达不到独占的效果。

     

          程序代码:

          注:以下fs和fs1对象变量我是放在了窗体中,作为窗体类的成员变量。


    [csharp]  view plain  copy
     print ?
    1. using System.IO;  
    2.   
    3. public FileStream fs = null;  
    4. public FileStream fs1 = null;  
    5.   
    6. //以独占方式打开文件  
    7. fs = new FileStream("C:\\Windows\\inf\\usbstor.inf", FileMode.Open, FileAccess.Read, FileShare.None);  
    8. fs1 = new FileStream("C:\\Windows\\inf\\usbstor.PNF", FileMode.Open, FileAccess.Read, FileShare.None);  
    展开全文
  • 源欣usbtors232驱动是一款usb转232串口驱动程序软件,适用于win7、win8和win10操作系统,可以帮助用户解决USB转串口问题,有需要者欢迎在下载1USBTORS232驱动介绍USBTORS232驱动,在配置的时候会用到哦,适合hlusb转...
  • 之前记得安装过这个驱动,但是近期无法使用,网上用了诸多办法,比如管理员模式运行、禁用驱动签名以及下载最新的驱动等等。 后来再看其他论坛中找到原因是在C:\Windows\System32\drivers缺少文件 serenum.sys 从...
  • USB学习笔记(5)STM32 USB库移植步骤

    千次阅读 2020-08-11 23:40:11
    USB学习笔记(5)STM32 USB库移植步骤 本文是将官网的USB驱动库文件移植到自己的工程里面,实现USB功能的具体移植步骤说明,实现Custom_HID功能。 1.先准备一个工程模板 获取工程:STM32F1-V1-工程模版 提取码:p6rg...
  • 台式机的win7 64位系统可以识别u盘,但笔记本的win7 64位却识别不了,说明U盘是... (代码 28)”。 解决方法: 用“驱动人生”软件检测,并安装驱动。 转载于:https://www.cnblogs.com/wi100sh/p/4315676.html...
  • http://www.linux-usb.org/usb.ids # # List of USB ID's # # Maintained by Stephen J. Gowdy # If you have any new entries, please submit them via # http://www.linux-usb.org/usb-ids.html # or send en
  • 我们分析的这个usb鼠标是一个输入类型的中断传输。 既然是输入类型,必然要做好接收。 而一个端点中,一次事务中,传输的的最大字节数即量是在端点描述符中定义的。 /* USB_DT_ENDPOINT: Endpoint descriptor */...
  • USB黄色叹号解决办法

    2010-04-19 21:52:34
    USB黄色叹号解决办法 USB黄色叹号解决办法 USB黄色叹号解决办法
  • USBCTRL USB上位机控制软件(源码)

    热门讨论 2012-08-30 10:50:52
    兼容CFI的write10(2A) read(28)命令,如果write10写入少于一个block的数据的话,会先先读出该block数据,再写入 3.增加自定义命令write(AA) read(A8),只是将write10和read10中的transfer length解析为byte数量,而...
  • USB状态错误及其原因(错误码)

    千次阅读 2019-11-01 16:28:26
    USB状态错误及其原因 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议。 本文链接:https://blog.csdn.net/leumber/article/details/72822349 The most significant 4 bits of USB status values are ...
  • 安卓设备的USB-HID通讯例程的开发 (1)

    千次阅读 2021-02-05 16:08:15
    安卓设备的USB-HID调试器的开发(1) 本博文系JGB联合商务组的原创作品,引用请标明出处 按惯例,先上调试场景图,不感兴趣的直接忽略之。 本HID设备(JGB01开发板)使用的芯片仍然是STM32F103C8T6,所烧录的C代码...
  • adb命令大全

    千次阅读 多人点赞 2019-06-03 22:19:07
    4.2.3 WLAN 连接(无需借助 USB 线) 4.2.4 WiFi 连接转为 USB 连接 4.3 应用管理 4.3.1 查看应用列表 4.3.1.1 查看所有应用 4.3.1.2 查看系统应用 4.3.1.3 查看第三方应用 4.3.1.4 包名包含某字符串的应用 4.3.2 ...
  • 基于51单片机的交通灯控制系统设计

    万次阅读 多人点赞 2018-11-24 13:38:11
    12脚、27脚及28脚定义为握手信号功能端口,连接主板CPU的相应功能端,用于当前制式的检测及会聚调整状态进入的控制功能。 P0口:P0口是一组8位漏极开路型双向I/O 口,也即地址/数据总线复用口。作为输出口用时,每...
  • STM32 基础系列教程 28 - USB_DFU

    千次阅读 2019-04-30 17:10:15
    学习stm32 USB接口使用,学会用CUBE工具快速创建USB设备工程及调试,关于usb的相关知道请读者提前准备并学习,当然如果不想深究其中原理的话,跟着本文来操作就可以实现基于USB的设备开发了。需要提示的是,stm32在...
  • D:\download\USB助手 源码 2008-12-30 08:44 <DIR> . 2008-12-30 08:44 <DIR> .. 2002-10-07 15:21 1,536 ChildFrm.cpp 2002-10-07 15:21 1,397 ChildFrm.h 2002-10-07 15:21 17,103 DevicesDlg.cpp 2002-10-07 15...
  • Android开发之USB数据通信

    千次阅读 2017-11-16 14:41:47
    1 ,UsbManager:负责管理USB设备的类,你可以在相应代码中通过以下方法获得 //获取UsbManager实例方法 UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);12 该类提供的主要方法有: ...
  • usb hid gadget驱动

    千次阅读 2016-10-31 10:13:37
    usb gadget框架层次 1 驱动层 2 复合层 3 控制器驱动层 二 初始化流程 1 驱动层介绍 2 hidg驱动初始化详解 1 至上而下遍历搜索绑定驱动和设备 2 至下而上遍历完成初始化 三 hid gadget应用参考文献因为usb gadget...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 17,673
精华内容 7,069
关键字:

usb代码28