Active Topics

 


Reply
Thread Tools
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#921
Originally Posted by pali View Post
@blue_led:
why is problem with autodetection usb speed? and it is possible to check if host usb device or charger is connected?
You miss 1 year ?

first q :switching speed need vbus go 0 Volts. for valid usb session vbus above 4.4 volts condition is needed . switching vbus from 0 to 5 v ( for setting speed ) will trigger an interrupt activating khubd, but usb phy and driver are not in a stable state and khubd go crazy ( timeout ). generic or custom KP kernel don't know how to switch isp1707 speed ( is "platform dependent" and not allowed when vbus is 5V ). if some patches will be writen for vbus switching in kernel some processes ( bme ) need to be stopped for leaving i2c device bq24150 free to controll. and for vbus stable a timer doing any action every less 32 s on bq21450's i2c interface also is needed
so pointing from kernel space to bme and setting a timer look ugly

it is easy doing all selections from userspace

second q: is not a problem

Last edited by blue_led; 2011-12-03 at 14:55.
 

The Following 3 Users Say Thank You to blue_led For This Useful Post:
Posts: 2,154 | Thanked: 8,464 times | Joined on May 2010
#922
I see that problem from kernel hostmode patch (error messages in musb_procfs.c), but I was not sure if switching vbus is only problem. But I started looking around bq2145x chip and I will write kernel module(s) for bq chip and charging...
 

The Following 11 Users Say Thank You to pali For This Useful Post:
Posts: 36 | Thanked: 9 times | Joined on Apr 2010 @ Phoenix, Arizona
#923
The jumper cables are a nice touch

Last edited by jbscurtis; 2011-12-03 at 18:54. Reason: spelling
 
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#924
@blue_led
the userland autospeed has one problem: it needs to either depend on sysklogd being installed or use kmsg directly. You need to support both cases, or rdepend on ksyslogd pkg.
You are aware you can find about lowspeed vs high/fullspeed devices by reading out the status registers of PHY, and IIRC they are even printed in syslog. on one the D+ is low while on other the D- is low (see USB 101 about lowspeed vs full/highspeed signalling via pullup R) [maybe the prev isn't all correct as I haven't re-read the specs myself just now, it's a while since I last looked into them]
Great to see your progress, while I clearly suck delivering that stuff :-D
Keep in mind it may take quite some time after disabling boost mode until VBUS drops to a sane level so you can switch speed. Maybe testing VBUS voltage may give a clue, or just insert a short (some 5..15s) charging phase so bq24150 will try to pull power and thus discharges VBUS rail. Otherwise musb_core might not allow proper changing of speed.

cheers and keep hacking
jOERG
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N

Last edited by joerg_rw; 2011-12-03 at 19:22.
 

The Following 6 Users Say Thank You to joerg_rw For This Useful Post:
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#925
Originally Posted by joerg_rw View Post
@blue_led
the userland autospeed has one problem: it needs to either depend on sysklogd being installed or use kmsg directly. You need to support both cases, or rdepend on ksyslogd pkg.
You are aware you can find about lowspeed vs high/fullspeed devices by reading out the status registers of PHY, and IIRC they are even printed in syslog. on one the D+ is low while on other the D- is low (see USB 101 about lowspeed vs full/highspeed signalling via pullup R) [maybe the prev isn't all correct as I haven't re-read the specs myself just now, it's a while since I last looked into them]
Great to see your progress, while I clearly suck delivering that stuff :-D
Keep in mind it may take quite some time after disabling boost mode until VBUS drops to a sane level so you can switch speed. Maybe testing VBUS voltage may give a clue, or just insert a short (some 5..15s) charging phase so bq24150 will try to pull power and thus discharges VBUS rail. Otherwise musb_core might not allow proper changing of speed.
jOERG
my script is plain, dumb, ash script. for sure it don't suffer for missing lib
i think there is a bug or some curent leakage on d+ line so with no device attached the driver see a full/high speed device. also some modern usb devices don't have a physical resistor on data lines. they are inside asics and connected by inside fet transistors as found in isp707. i can't control how kernel deal with those cips . and i think this pull-up resistor is not connected instantly so the driver don't act well.
in sys log i see "Forcemode... no device attached" followed immediately by "Forcemode ... full spped device detected" .
my script is "event driven" so it wait for vbus changes, and sys messages. setting speed is not a problem but driver don't act as expected.
in one case i see "b-host" state


Late edit:
i found proper ( stable) procedure for sensing low speed devices when high or full speed is set.
rmmod g_file_storage is the key ( workaround ) . proper solution is interrupt deactivation for "vbus stable"

Last edited by blue_led; 2011-12-03 at 21:59.
 

The Following 2 Users Say Thank You to blue_led For This Useful Post:
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#926
Originally Posted by blue_led View Post
my script is plain, dumb, ash script. for sure it don't suffer for missing lib
I don't talk about libs, I related to the way you get syslog/dmesg logs from kernel. Not all systems have pkg sysklogd installed, and on those who have you will need to use sth along the line of "tail -f /var/log/syslog" as the only alternative source for kernel logging (/proc/kmesg) is already occupied by the syslog daemon, I.E. a logger msg would either go to syslog or to your process listening to /proc/kmsg then on a random basis, if you'd use /proc/kmsg on a system with syslog installed.
On systems that have no /var/log/syslog OTOH you either install sysklogd pkg to get /var/log/syslog, or you need to use /proc/kmsg.


Originally Posted by blue_led View Post
i think there is a bug or some curent leakage on d+ line so with no device attached the driver see a full/high speed device. also some modern usb devices don't have a physical resistor on data lines. they are inside asics and connected by inside fet transistors as found in isp707. i can't control how kernel deal with those cips . and i think this pull-up resistor is not connected instantly so the driver don't act well.
in sys log i see "Forcemode... no device attached" followed immediately by "Forcemode ... full spped device detected" .
my script is "event driven" so it wait for vbus changes, and sys messages. setting speed is not a problem but driver don't act as expected.
in one case i see "b-host" state


Late edit:
i found proper ( stable) procedure for sensing low speed devices when high or full speed is set.
rmmod g_file_storage is the key ( workaround ) . proper solution is interrupt deactivation for "vbus stable"
you mostly lost me on all that, except the "event driven" detail. I'm not aware of any such bug and couldn't figure how normal hostmode would work if normal peripherals wouldn't adhere to the standards regarding pullup/down resistors. What do you mean by "interrupt deactivation"? The state changes on USB/VBUS are sensed by ke-recv and/or hulda process via kernel event messages, quite similar to udev. ke-recv and/or udev and/or hulda then start requester which in turn loads g_file_storage (or was it g_nokia?) - IIRC

cheers
jOERG
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N

Last edited by joerg_rw; 2011-12-03 at 23:10.
 

The Following 4 Users Say Thank You to joerg_rw For This Useful Post:
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#927
you are all right.
dropping vbus activate g_file storage and i don't need this.

i have final scenario:
1 stop bme
2 vbus on
3 rmmod g_file_storage
4 force low
5 F > ..
6 listen to messages ( hard speed detection )
7 if no message >> low speed device
if full/high message >> go further ( step 8 )
if no device >> exit
8 put usb in stable state ...... ( here need more tests including modprobe g_file_storage or switch to peripheral )
9 force full
11 F >
12 if message "force ..error... high speed device .. but not high.." >> go high ( soft speed detection )
exit

i don't see a fastest way

Last edited by blue_led; 2011-12-03 at 23:50.
 

The Following 2 Users Say Thank You to blue_led For This Useful Post:
Posts: 2,154 | Thanked: 8,464 times | Joined on May 2010
#928
@blue_led:
What about modifing musb_procfs.c (or in other kernel parts) to do this detection in kernel?
 

The Following 2 Users Say Thank You to pali For This Useful Post:
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#929
@pali
it can be very possible, even OTG mode
but this depend on vbus switching and the patch will be very specialized pointing only for rx51
sensing speed of device can be done without a timer for bq24500. 32s is enough for all jobs
now it is clear for me how to do this. as my post above..
first part ->hardware detection of the device
power the vbus and read debug register
here we have 3 cases
0 no device
1 low speed device
2 high or full
after this, speed can be set and read device descriptor
if the device is high speed then switch
high speed devices can be read in full speed mode

the goal of my script is to prove the concept

@everybody

[Announce] The n900 hostmode script
features: icon, automatic speed, status area icon ,notifications, mass sotorage automount, no gui

unzip the attachment in a folder
as root run
Code:
chmod 755 install.sh
install.sh
LE: zip updated with icon file. sorry for mistake
please reload

To support efforts press "Thanks"
Attached Files
File Type: zip host.zip (4.3 KB, 203 views)

Last edited by blue_led; 2011-12-12 at 18:59.
 

The Following 13 Users Say Thank You to blue_led For This Useful Post:
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#930
Originally Posted by blue_led View Post
@pali
it can be very possible, even OTG mode
but this depend on vbus switching and the patch will be very specialized pointing only for rx51
sensing speed of device can be done without a timer for bq24500. 32s is enough for all jobs
now it is clear for me how to do this. as my post above..
first part ->hardware detection of the device
power the vbus and read debug register
here we have 3 cases
0 no device
1 low speed device
2 high or full
after this, speed can be set and read device descriptor
if the device is high speed then switch
high speed devices can be read in full speed mode

the goal of my script is to prove the concept

@everybody

[Announce] The n900 hostmode script

unzip the attachment in a folder
as root run
Code:
chmod 755 install.sh
install.sh
Yes, this concept is correct. I don't know what you mean by "32s is enough" though. At least bq24150 watchdog will need 10s at worst case

cheers
jOERG
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N
 

The Following 2 Users Say Thank You to joerg_rw For This Useful Post:
Reply

Tags
bada rox, detection, h-e-n, hostmode, speed, usb host


 
Forum Jump


All times are GMT. The time now is 01:35.