Comments (2)
Notes on trigger
while $true; do cat /sys/kernel/debug/20980000.usb/regdump | grep HPRT0; sleep 1; done
Host Port Control and Status register
=====================================
Reg value is dumpable via debugfs for DesignWare USB 2.0 host controller (dwc2)
The dump could be triggered via debugff by reading `/sys/kernel/debug/20980000.usb/regdump` which holds the value for the register in `HPRT0`.
The problem with the approach: The register dump has to be triggered by polling /sys/kernel/debug/20980000.usb/regdump and dumps ALL registers.
This seems to crash the UDC from time to time, in contrast to the comment of the kernel source (https://github.com/raspberrypi/linux/blob/rpi-4.14.y/drivers/usb/dwc2/debugfs.c#L402).
HPRT --> Host Port Control and Status Register, details on data struct:
https://www.cl.cam.ac.uk/~atm26/ephemeral/rpi/dwc_otg/doc/html/unionhprt0__data.html#a964274b5d22e89ca4490f66dff3c763
Meanings of struct fields:
https://www.intel.com/content/www/us/en/programmable/documentation/sfo1410144425160/sfo1410067646785/sfo1410069362932/sfo1410069623936/sfo1410069628257/sfo1410069409998.html
01741 typedef union hprt0_data {
01743 uint32_t d32;
01745 struct {
01746 unsigned prtconnsts:1;
01747 unsigned prtconndet:1;
01748 unsigned prtena:1;
01749 unsigned prtenchng:1;
01750 unsigned prtovrcurract:1;
01751 unsigned prtovrcurrchng:1;
01752 unsigned prtres:1;
01753 unsigned prtsusp:1;
01754 unsigned prtrst:1;
01755 unsigned reserved9:1;
01756 unsigned prtlnsts:2;
01757 unsigned prtpwr:1;
01758 unsigned prttstctl:4;
01759 unsigned prtspd:2;
01760 #define DWC_HPRT0_PRTSPD_HIGH_SPEED 0
01761 #define DWC_HPRT0_PRTSPD_FULL_SPEED 1
01762 #define DWC_HPRT0_PRTSPD_LOW_SPEED 2
01763 unsigned reserved19_31:13;
01764 } b;
01765 } hprt0_data_t;
Test results (polling /sys/kernel/debug/20980000.usb/regdump and parsing "HPRT0")
=================================================================================
USB gadget running, but OTG adapter attached, NO device connected to the OTG adapter
--> prtlnsts = 0 (No data line on positive logic level)
--> prtpwr = 1 (the port is powered ... at least if there's no overcorrency)
--> prtconnsts = 0 (No device attached)
USB gadget running, but OTG adapter attached, device connected to the OTG adapter
--> prtlnsts = 0,1 or 2 (changes)
--> prtpwr = 1 (the port is powered ... at least if there's no overcorrency)
--> prtconnsts = 1 (A device is attached)
--> prtspd = 1 or 2 (for non high speed devices)
USB gadget running, no OTG adapter attached, but NOT connected to host as a peripheral
--> prtlnsts = 1 (Logic Level of D+ is 1, logic level of D- is 0)
--> prtpwr = 0
--> prtconnsts = 0 (No device attached)
USB gadget running, no OTG adapter attached, connected to host as a peripheral
--> prtlnsts = 0 (both, D+ and D-, are indicated as low)
--> prtpwr = 0
--> prtconnsts = 0 (No device attached)
--> in fact the whole HPRT0 is set to 0x00000000 if connected to a host in device mode
WARNING: Constant reading from the regdump file sometimes crashes UDC
from p4wnp1_aloa.
The debugfs based Trigger has been replaced by a customized dwc2
driver, which sends connection events to userspace via gennetlink (directly from the ISR of the USB softreset interrupt)
from p4wnp1_aloa.
Related Issues (20)
- This is not an issue, but why is the project dead? HOT 3
- Pawnpi
- pi zero 2 w not booting HOT 1
- Compatibility HOT 1
- I used and now i cant get rid of the dscript from my PC
- How to delete old hid scripts HOT 1
- How to program a mouse movement HOT 1
- OpenStick question HOT 1
- P4wnP1_aloa not running on Raspberry Pi Zero W HOT 5
- How to change website local IP address
- Not working HOT 2
- SSH Password doesn`t work
- Mass storage over 4gb
- Mass storage over 4 GB
- Rndis Eternet to usb
- If i try to change any setting it doesnโt work. HOT 1
- Would I be able to store information from the computer to the raspberry pi or the console?
- Not Writing
- Can't scape "\" and can't write " " " with spanish layout
- Bridging the WiFi and Ethernet network for a remote shell to an air-gapped PC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p4wnp1_aloa.