Git Product home page Git Product logo

usb-hub-linux-examples's Introduction

USB-Hub-Linux-Examples

Linux example code that accompanies MCHP USB Smart hubs

General USB Examples

Within this folder a user can find example code that allows compliance tests to be run.

USB Hub Feature Example

Within this folder, example code can be be found that is compatible with various Microchip Hubs. Examples include USB bridging, battery charging and role switching.

usb-hub-linux-examples's People

Contributors

lim-linyuanbo avatar mchp-connorchilton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

usb-hub-linux-examples's Issues

Problem in i2c_Bridging/ code

Hi i am experimenting probably a bug for i2c_Bridging code.

I have this situation:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 0424:494a Microchip Technology, Inc. (formerly SMSC) USB47xx/49xx hub integrated WinUSB + I2S audio port
Bus 001 Device 006: ID 0424:4715 Microchip Technology, Inc. (formerly SMSC) USB4715 high-speed hub
Bus 001 Device 005: ID 05e3:0723 Genesys Logic, Inc. GL827L SD/MMC/MS Flash Card Reader
Bus 001 Device 004: ID 093a:2533 Pixart Imaging, Inc. OpticalMouse
Bus 001 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 1: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M
|__ Port 1: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 3: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 4: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 4: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 5: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
|__ Port 6: Dev 6, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 5: Dev 7, If 3, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 5: Dev 7, If 1, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 5: Dev 7, If 2, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 5: Dev 7, If 0, Class=Vendor Specific Class, Driver=, 480M

and it seems that the microship hub that i have that is the usb4715 is the Bus 001 Device 006: ID 0424:4715 device.
So in order to make a read of 1 byte from 12c device 0x38 (attached to one of the port of this hub) on register 0x4020 i run:

sudo ./i2cBridging 0x0424 0x4715 "1:6" 0x00 0x38 0x4020 1

but i receive this retunr:

SDK Version:1.23
VID:PID = 0424:4715, Device Path - :6

I2C Bridging Demo
DEBUGINFO: MCHP_Error_Device_Not_Found

Error: MchpUsbOpenID Failed:

i think that the usb open devic function finds only usb device with portmax at equal to 1 and not equal to 2.

in the for cycle for(;hub_index < 10;hub_index++) in MhcpUSBInterface.cpp i printed with this

printf("\nDEBUG:gasHubInfo[hub_index].wVID --> %x\n"
"gasHubInfo[hub_index].wPID --> %x\n"
"gasHubInfo[hub_index].port_max --> %d\n"
"gasHubInfo[hub_index].wDID --> %x\n"
"gasHubInfo[hub_index].wSKUNAME --> %x\n"
"gasHubInfo[hub_index].port_list[0] --> %d\n"
"gasHubInfo[hub_index].port_list[1] --> %d\n"
"gasHubInfo[hub_index].port_list[2] --> %d\n"
"gasHubInfo[hub_index].port_list[3] --> %d\n"
"gasHubInfo[hub_index].port_list[4] --> %d\n"
"gasHubInfo[hub_index].port_list[5] --> %d\n"
"gasHubInfo[hub_index].port_list[6] --> %d\n"
"gasHubInfo[hub_index].deviceName -->%s\n"
"i -->%d\n",
gasHubInfo[hub_index].wVID,
gasHubInfo[hub_index].wPID,
gasHubInfo[hub_index].port_max,
gasHubInfo[hub_index].wDID,
gasHubInfo[hub_index].wSKUNAME,
gasHubInfo[hub_index].port_list[0],
gasHubInfo[hub_index].port_list[1],
gasHubInfo[hub_index].port_list[2],
gasHubInfo[hub_index].port_list[3],
gasHubInfo[hub_index].port_list[4],
gasHubInfo[hub_index].port_list[5],
gasHubInfo[hub_index].port_list[6],
gasHubInfo[hub_index].deviceName,
i);

all device's info and it seems find only one device with portmax=1
DEBUG:gasHubInfo[hub_index].wVID --> 424
gasHubInfo[hub_index].wPID --> 4715
gasHubInfo[hub_index].port_max --> 1
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 6
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 6
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->
i -->2

DEBUG:gasHubInfo[hub_index].wVID --> 0
gasHubInfo[hub_index].wPID --> 0
gasHubInfo[hub_index].port_max --> 0
gasHubInfo[hub_index].wDID --> 0
gasHubInfo[hub_index].wSKUNAME --> 0
gasHubInfo[hub_index].port_list[0] --> 0
gasHubInfo[hub_index].port_list[1] --> 0
gasHubInfo[hub_index].port_list[2] --> 0
gasHubInfo[hub_index].port_list[3] --> 0
gasHubInfo[hub_index].port_list[4] --> 0
gasHubInfo[hub_index].port_list[5] --> 0
gasHubInfo[hub_index].port_list[6] --> 0
gasHubInfo[hub_index].deviceName -->

so it will never enter into the if subsection snippet code below.

Is it a bug?

i2cBridging : how to set Devicepath(string)

Here is my usb deivces list:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 10c4:ea70 Cygnal Integrated Products, Inc. CP210x UART Bridge
Bus 001 Device 003: ID 0424:4041 Standard Microsystems Corp.
Bus 001 Device 002: ID 0424:2640 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Can you advice how to set Devicepath? I tried several command. Always get failed:

SDK Version:1.23
VID:PID = 0424:2640, Device Path - :1

I2C Bridging Demo
DEBUGINFO: libusb_control_transfer device[0]: DEBUGINFO: LIBUSB_ERROR_PIPE
DEBUGINFO: MCHP_Error_Device_Not_Found

Error: MchpUsbOpenID Failed:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.