maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 will not allow USB OTG! (https://talk.maemo.org/showthread.php?t=31921)

titan 2010-05-17 20:17

Re: N900 will not allow USB OTG!
 
yes, I did see the log message. maybe my USB A F/F adapter is broken? or my USB hub??
here's the script I used:
Code:

#!/bin/sh
echo 5 > /sys/module/musb_hdrc/parameters/debug
echo host >/sys/devices/platform/musb_hdrc/mode
sleep 1
echo H >/proc/driver/musb_hdrc
cat /sys/devices/platform/musb_hdrc/mode

Quote:

Originally Posted by egoshin (Post 662812)
Interesting. Sometime I can't do it too but I blamed it to some leftovers and repeat it after removing battery.
BTW, did you see in log a message "twl4030_set_host() after 4030 OTG_CTRL=0x26"?


egoshin 2010-05-18 05:20

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by titan (Post 663024)
yes, I did see the log message. maybe my USB A F/F adapter is broken? or my USB hub??
here's the script I used:
Code:

#!/bin/sh
echo 5 > /sys/module/musb_hdrc/parameters/debug
echo host >/sys/devices/platform/musb_hdrc/mode
sleep 1
echo H >/proc/driver/musb_hdrc
cat /sys/devices/platform/musb_hdrc/mode


Can you show the log? There are some conditions which should be set and I suspect - there is a difference in hubs too.

blue_led 2010-05-18 21:50

Re: N900 will not allow USB OTG!
 
i found why otg state machine skip some states

from http://mxr.maemo.org/fremantle/sourc...usb/omap2430.c

155 static void omap_set_vbus(struct musb *musb, int is_on)
156 {
157 u8 devctl;
158 /* HDRC controls CPEN, but beware current surges during device
159 * connect. They can trigger transient overcurrent conditions
160 * that must be ignored.
161 */
162
163 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
164
165 if (is_on) {
166 musb->is_active = 1;
167 musb->xceiv->default_a = 1;
168 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
169 devctl |= MUSB_DEVCTL_SESSION;
170
171 MUSB_HST_MODE(musb);
172 } else {
173 musb->is_active = 0;
174
175 /* NOTE: we're skipping A_WAIT_VFALL -> A_IDLE and
176 * jumping right to B_IDLE...
177 */
178

179 musb->xceiv->default_a = 0;
180 musb->xceiv->state = OTG_STATE_B_IDLE;
181 devctl &= ~MUSB_DEVCTL_SESSION;
182
183 MUSB_DEV_MODE(musb);
184 }
185 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
186
187 DBG(1, "VBUS %s, devctl %02x "
188 /* otg %3x conf %08x prcm %08x */ "\n",
189 otg_state_string(musb),
190 musb_readb(musb->mregs, MUSB_DEVCTL));
191 }


i run around this code and from http://mxr.maemo.org/fremantle/sourc...usb/tusb6010.c

1141 if (is_host_enabled(musb))
1142 musb->board_set_vbus = tusb_source_power;
1143 if (is_peripheral_enabled(musb))
1144 xceiv.set_power = tusb_draw_power;


workaround : can we put some #ifdef ...board_rx-51 ... code for charge vbus from bq24150 ?

omap_set_vbus need more attention
line 167 : wait to rise vbus over 4.4 V and after that at line 171 we have host enabled

220 #define MUSB_HST_MODE(_musb)\
221 { (_musb)->is_host = true; }

i think this host mode can be sustained by vbus above 4.4v or by session valid as i found here http://talk.maemo.org/showpost.php?p...&postcount=783

latest specifications allow peripherals detection in absence of vbus . this must be checked on isp1707 case

joerg_rw 2010-05-18 23:38

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 664922)
i found why otg state machine skip some states
...
...

Well, nice finding, but WE DO NOT WANT OTG!!!!
WE NEED PLAIN HOSTMODE

[edit]
As javispedro made clear to me, this is a little ambiguous. So let me elaborate...
Code:

musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
is about OTG state machine (evident by the name if nothing else).
We need to avoid OTG state machine, we want
Code:

echo host >mode
to work correctly.
Correctly here means:
  • configure PHY to host setup = 2 pulldown R instead of 1 pullup for device mode
  • disable VBUS interrupt triggering weird state changes in OTG state machine (either by switching off the interrupt in TWL4030, or by setting the driver to a mode where it ignores this interrupt)
  • enable PHY originated "IRQ" (this in fact is a ULPI state message I guess) for detecting attachment of peripheral devices, I.E. sense when one of the D-lines is pulled high by the peripheral's pullup R from VBUS to D(+/-)
  • on detection of peripheral attachment, start whatever a plain vanilla host does (ENUM etc)
Nota bene this list does NOT include enabling VBUS boost to supply 5V to USB, as we want to handle that independently from logical hostmode (refer to http://wiki.openmoko.org/wiki/USB_ho...USB_host_modes). We might want to operate hostmode without burning battery for VBUS boost, by using an externally powered hub. We even might want to charge N900 while in logical hostmode (a very common usecase)

blue_led 2010-05-19 00:43

Re: N900 will not allow USB OTG!
 
but lines 1141-1142 from tusb6010 don't ring a bell ?

joerg_rw 2010-05-19 00:56

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 665076)
but lines 1141-1142 from tusb6010 don't ring a bell ?

Yes, they tell me tusb6010 driver is not considering we might want logical host mode WITHOUT powering the peripheral device (maybe the device this driver was written for doesn't make sense with non-powered hostmode, e.g when it's a device with decent power supply, not a battery and charging over USB). We don't want to make same mistake, and plain vanilla hostmode DOES NOT NEED VBUS to work, it should rather be totally agnostic about VBUS state, so the line
Code:

musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
clearly indicates there's something fishy with the way we try to achieve hostmode on N900 by now.
Rationale: a plain vanilla USB host has a "always on" 5V VBUS supply (sometimes literally, just hooked up to system's main 5V rail), and there is no such thing like handling VBUS for a simple host, that's all OTG which we want to avoid after all.

flailingmonkey 2010-05-19 01:06

Re: N900 will not allow USB OTG!
 
I understand that OTG is not our end goal, but hasn't the progress so far in putting the N900 into a host role and communicating with USB devices been by using what was left in the kernel or drivers for the purposes of OTG?

It seems that there are a few approaches being taken towards connecting the N900 to USB devices (as devices), so perhaps the relevent wiki page http://wiki.maemo.org/N900_Hardware_USB_Host needs to be updated? There is a lot of information that repeatedly get clarification, which might be easier to organize in a single page rather than reading through every post.

egoshin 2010-05-19 06:16

Re: N900 will not allow USB OTG!
 
Friends,

We need first to set USB H/W in host mode without Host Negotiation Protocol invocation. I tried (briefly) FORCE_HOST mode but 1707 doesn't recognize a device connect. It is needed to eliminate initial PC connection from picture. It may be:

a) incorrect pulldown - and I am reading USB protocols to find which should be used and how. 1707 or other side may not able to read correctly with incorrect pulldowns.

b) a hub is not required to support any connection-style USB protocol (i used HUB to get USB stick mounted) - it should be in constant connect mode and send a periodic updates.

I plan to repeat a FORCE_HOST mode test with external Hard Disk which may support a "connection" protocol. But I also browse through my electronic equipment which has microusb - it SHOULD support "connect" message.

EDIT: if ARM USB gets "connect" message (actually - "session started") then musb driver works - my experiment proves that!

Also I try to figure out - is "connection" signaling is needed to switch USB in a real host mode or is not - the problem is that then I used FORCE_HOST mode then the slave device doesn't react on any write or read transfer - looked like other side is dead.

Finally, a driver doesn't support ADP at all but I think with manual host mode setup it should be not an issue for us.

egoshin 2010-05-19 06:36

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by joerg_rw (Post 665017)
[*]configure PHY to host setup = 2 pulldown R instead of 1 pullup for device mode

I will double check but it seems that 1707 has both pulldown R. You can find my message a couple of days ago then I was surprised by this difference with 1704 description. Looks like driver was prepared to work in host mode (?)

Quote:

[*]disable VBUS interrupt triggering weird state changes in OTG state machine (either by switching off the interrupt in TWL4030, or by setting the driver to a mode where it ignores this interrupt)
VBUS interrupt from TWL4030 has nothing with musb driver in N900 - it passes it. driver works only with musb interrupts and twl4030 interrupt just triggers change in some /sys file and message to ke-recv.

Quote:

[*]enable PHY originated "IRQ" (this in fact is a ULPI state message I guess) for detecting attachment of peripheral devices, I.E. sense when one of the D-lines is pulled high by the peripheral's pullup R from VBUS to D(+/-)
That is ADP, I suspect. It is not needed now as long as musb driver is forced in HOST mode - we expect do USB host fast today. Later - yes, to save energy, but it is a next stage, I believe.

EDIT: from USB docs it seems that ADP is needed only as a signal to switch VBUS on. And other docs says that ADP flip-flop and recogntion are manual - and it is a reason why it is absent from musb (nobody wrote it :))

Quote:

[*]on detection of peripheral attachment, start whatever a plain vanilla host does (ENUM etc)
For a moment, musb driver waits "session start" interrupt to continue and "hostmode" + "session" bits in DEVCTL + VBUS in DEVCTL. If it gets all three - we have a right whole protocol stack on top of musb (usb read/write, enumeration, usb-2-SCSI conversion etc).

joerg_rw 2010-05-19 06:52

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by egoshin (Post 665375)
Friends,

We need first to set USB H/W in host mode without Host Negotiation Protocol invocation.
I tried (briefly) FORCE_HOST mode but 1707 doesn't recognize a device connect. It is needed to eliminate initial PC connection from picture. It may be:

a) incorrect pulldown - and I am reading USB protocols to find which should be used and how. 1707 or other side may not able to read correctly with incorrect pulldowns.

b) a hub is not required to support any connection-style USB protocol (i used HUB to get USB stick mounted) - it should be in constant connect mode and send a periodic updates.

well, that's exactly what I said 2 posts above

Quote:

Originally Posted by egoshin (Post 665375)
I plan to repeat a FORCE_HOST mode test with external Hard Disk which may support a "connection" protocol. But I also browse through my electronic equipment which has microusb - it SHOULD support "connect" message.

EDIT: if ARM USB gets "connect" message (actually - "session started") then musb driver works - my experiment proves that!

yes. OTG is a full host protocol driver (plus device protocol driver) plus some state machine wrapper

Quote:

Originally Posted by egoshin (Post 665375)
Also I try to figure out - is "connection" signaling is needed to switch USB in a real host mode or is not - the problem is that then I used FORCE_HOST mode then the slave device doesn't react on any write or read transfer - looked like other side is dead.

Finally, a driver doesn't support ADP at all but I think with manual host mode setup it should be not an issue for us.

Connection signaling is needed to start negotiation/ENUM of the host. Connection is defined as pullup of one of the D-lines, and that depends on correct pulldown Rs on host and pullup R on device.
For lockup please refer to
musb_core.c line 2496 "/* resets the controller..."

blue_led 2010-05-19 11:30

Re: N900 will not allow USB OTG!
 
because some functions of kernel seems to be in place the single problem i see is vbus power management in host mode as i see host mode depend on this
on N900 vbus power management is broken because it use another asic OUTSIDE tusb6010 for which driver is not written.
on N810 this driver work so somebody must check with a patched driver ( with removed sections of vbus power ) if any device can work without vbus.
after that we can hope n900 will do the same
vbus will and can be a future option in driver / selection mode software
few weeks ago ( beginning of march ) i tried to inject vbus & session_valid on phy asic http://talk.maemo.org/showpost.php?p...&postcount=619 ( i will post a picture with test board )
i never believe the driver and HNP can be so grossly as manual removal of device from pc
i try the same thing as egoshin ( conect / disconect from a hub ) . http://talk.maemo.org/showpost.php?p...&postcount=624 .
tight usb timings blinded me .i have no success because i did not stop ( nasty word here ) bme

MohammadAG 2010-05-19 18:01

Re: N900 will not allow USB OTG!
 
Applied the patches (they only seem to add a kernel message when echoing host), kernel built and flashed.
Raised power output to 5V using joerg_rw's command.
However I still can't get it to work, the flash drive gets rejected.
Code:

[ 3129.551940] kb_lock (GPIO 113) is now closed
[ 3129.716766] kb_lock (GPIO 113) is now open
[ 3163.176361] twl4030_set_host() 4030 OTG_CTRL=0x26
[ 3163.176635] twl4030_set_host() after 4030 OTG_CTRL=0x26
[ 3180.815826] usb 1-1: USB disconnect, address 5
[ 3181.091003] usb 1-1: new high speed USB device using musb_hdrc and address 6
[ 3181.240814] usb 1-1: rejected 1 configuration due to insufficient available bus power
[ 3181.240844] usb 1-1: no configuration chosen from 1 choice


joerg_rw 2010-05-19 18:07

Re: N900 will not allow USB OTG!
 
please have a close look to
http://mxr.maemo.org/fremantle/sourc...sb/musb_core.c
145 static inline int musb_verify_charger(void __iomem *addr)
ff
207

for seemingly working handling of the pullup/pulldown Rs (the MAIN most IMPORTANT config in PHY for hostmode)

joerg_rw 2010-05-19 18:15

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666416)
Applied the patches (they only seem to add a kernel message when echoing host), kernel built and flashed.
Raised power output to 5V using joerg_rw's command.
However I still can't get it to work, the flash drive gets rejected.
[code][ 3129.551940] kb_lock (GPIO 113) is now closed
[ 3129.716766] kb_lock (GPIO 113) is now open
[ 3163.176361] twl4030_set_host() 4030 OTG_CTRL=0x26
[ 3163.176635] twl4030_set_host() after 4030 OTG_CTRL=0x26
[ 3180.815826] usb 1-1: USB disconnect, address 5
[ 3181.091003] usb 1-1: new high speed USB device using musb_hdrc and address 6
[ 3181.240814] usb 1-1: rejected 1 configuration due to insufficient available bus power
[ 3181.240844] usb 1-1: no configuration chosen from 1 choice

please see
61 * HP's USB bus-powered keyboard has only one configuration
ff
in http://mxr.maemo.org/fremantle/sourc...core/generic.c
Code:

61                  * HP's USB bus-powered keyboard has only one configuration
62                  * and it claims to be self-powered; other devices may have
63                  * similar errors in their descriptors.  If the next test

Code:

135        if (insufficient_power > 0)
136                dev_info(&udev->dev, "rejected %d configuration%s "
137                        "due to insufficient available bus power\n",
138                        insufficient_power, plural(insufficient_power));



[edit]
ok, seems we killed that issue by patching out a few rather useless checks in kernel. Probably MohammadAG will come up with a small and dirty patch eventually. No big thing though. Still the fake hostmode by tricking OTG statemachine, I.E needs laptop to simulate the yet missing switch of PHY to host config (2 pulldowns)

hcm 2010-05-19 22:09

Re: N900 will not allow USB OTG!
 
1 Attachment(s)
guys, I have some news about bme's i2c communication with bq24150.
Be aware that this is ALL communication to bq24150 through the kernel. Not necessarily only by BME.

initialisation (contains some nonsense IMHO):
Code:

i2c-2 (W): 0x3b, (R) 1 bytes,        // read register 0x3b (wraps to 0x03, datasheet states otherwise!)
i2c_read:  0x4b                        // result: Vendor/Part/Revision
i2c-2 (W): 0x3b, (R) 1 bytes,        // same
i2c_read:  0x4b
i2c-2 (W): 0x00, (R) 1 bytes,        // read status/control register
i2c_read:  0x00                        // reset state should be x1xx 0xxx (datasheet)
i2c-2 (W): 0x00 0x80,                // reset safety timer
i2c-2 (W): 0x02, (R) 1 bytes,        // read control/battery register
i2c_read:  0x8c                        // 3.5V + 700mV
i2c-2 (W): 0x02 0x8c,                // set control/battery to same value
i2c-2 (W): 0x00, (R) 1 bytes,        // read status
i2c_read:  0x00
i2c-2 (W): 0x00 0x00,                // write status
i2c-2 (W): 0x01, (R) 1 bytes,        // read control register
i2c_read:  0x06                        // charger disabled, high impedance
i2c-2 (W): 0x01 0x06,                // set to same value
i2c-2 (W): 0x00, (R) 1 bytes,        // read status
i2c_read:  0x00
i2c-2 (W): 0x01, (R) 1 bytes,        // read control register
i2c_read:  0x06                        // same as above
i2c-2 (W): 0x01 0x06,                // set to same value again
i2c-2 (W): 0x01, (R) 1 bytes,        // read again
i2c_read:  0x06
i2c-2 (W): 0x01 0x06,                // write again

every 15s:
Code:

i2c-2 (W): 0x00 0x80,                // reset safety timer
i2c-2 (W): 0x00, (R) 1 bytes,        // read status
i2c_read:  0x00
i2c-2 (W): 0x02, (R) 1 bytes,        // read control/battery register
i2c_read:  0x8c
i2c-2 (W): 0x04, (R) 1 bytes,        // read battery termination/fast charge current register
i2c_read:  0xca                        // charge current sense voltage = 27.2mV
                                // termination current sense voltage = 6.8mV

nothing too special, yet. But the printk's can be usefull when trying to find out how BME destroys VBUS, etc…

The diff for my printk's are attached.

blue_led 2010-05-19 22:24

Re: N900 will not allow USB OTG!
 
those messages are obtained with high power charger attached , right ?
so nothing special , bme reset 32 s timer 4 times per minute . too often i think but in charge mode any battery savings is nonsense.
bme don't destroy vbus , simply bme have no idea ( and code ) about vbus and host mode status.
code is written only for charging mode not charge or boost vbus

blue_led 2010-05-19 22:28

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666416)
Applied the patches (they only seem to add a kernel message when echoing host), kernel built and flashed.
Raised power output to 5V using joerg_rw's command.
However I still can't get it to work, the flash drive gets rejected.
Code:

[ 3129.551940] kb_lock (GPIO 113) is now closed
[ 3129.716766] kb_lock (GPIO 113) is now open
[ 3163.176361] twl4030_set_host() 4030 OTG_CTRL=0x26
[ 3163.176635] twl4030_set_host() after 4030 OTG_CTRL=0x26
[ 3180.815826] usb 1-1: USB disconnect, address 5
[ 3181.091003] usb 1-1: new high speed USB device using musb_hdrc and address 6
[ 3181.240814] usb 1-1: rejected 1 configuration due to insufficient available bus power
[ 3181.240844] usb 1-1: no configuration chosen from 1 choice


try with a minimum 100 uF capacitor on vbus to avoid vbus drop ( early host specs don't throw with tomato )
681 if (int_usb & MUSB_INTR_VBUSERROR) {
682 int ignore = 0;
683
684 /* During connection as an A-Device, we may see a short
685 * current spikes causing voltage drop, because of cable
686 * and peripheral capacitance combined with vbus draw.
687 * (So: less common with truly self-powered devices, where
688 * vbus doesn't act like a power supply.)
689 *
690 * Such spikes are short; usually less than ~500 usec, max
691 * of ~2 msec. That is, they're not sustained overcurrent
692 * errors, though they're reported using VBUSERROR irqs.
693 *
694 * Workarounds: (a) hardware: use self powered devices.
695 * (b) software: ignore non-repeated VBUS errors.
696 *
697 * REVISIT: do delays from lots of DEBUG_KERNEL checks
698 * make trouble here, keeping VBUS < 4.4V ?
699 */
700 switch (musb->xceiv->state) {
701 case OTG_STATE_A_HOST:
702 /* recovery is dicey once we've gotten past the
703 * initial stages of enumeration, but if VBUS
704 * stayed ok at the other end of the link, and
705 * another reset is due (at least for high speed,
706 * to redo the chirp etc), it might work OK...
707 */

Dollyknot 2010-05-19 22:51

Re: N900 will not allow USB OTG!
 
We might want to operate hostmode without burning battery for VBUS boost, by using an externally powered hub.

Yeah we want to give our baby more energy, not take energy from it.


04-26-10 , 01:47 PM
Posts: 82 | Thanked: 9 times | Joined on Nov 2009 @ leicester UK

Report This | #1
Someone on one of the forums mentioned that the 'Memorex Travellink' could be used to transfer files from the n900 to a USB memory stick so I bought one.

Needless to say it did not work first time, but I thought it was still worth it because I could read and copy the SD card with it, so it would still be usable when I start travelling later on in the year.

Somebody posted an app to mount an exterior partition, so I downloaded it, plugged a USB stick into the Travellink and the n900 USB link 'coz I thought I could mount the stick with the downloaded app.

Much to my pleasant surprise, the Travellink was able to see files on my n900 and transfer them to my USB memory stick without the use of a PC or laptop, also it not did not need the mounter wizard.

What might have happened the first time is, I tried to do it without a fully charged battery, this time I tried with a fully charged battery, the perfect accessory for the traveller who wants to shoot lots of videos and store them on the road without carrying lots of kit.

The Travellink runs on three AA batteries, which I would imagine can be bought all over the planet.

MohammadAG 2010-05-19 23:25

Re: N900 will not allow USB OTG!
 
Compiled a kernel that works (finally! - thanks to joerg_rw for pointing out how to stop any power limits - my flash apparently needs more power).
I'll post a patch shortly.

I also got an HDD working, using the laptop as a power source, and without any "real" hub in between (using a Y cable though).

The echo host > ... part is redundant and doesn't do anything, so it can be left out.
Not sure about the patches, but it seems they only add messages to the kernel messages. Also I had to edit the .config file directly not the one in arch/arm/configs, since that didn't change anything (thanks to javispedro for that one)

Code:

[ 1617.796691] g_nokia gadget: high speed config #1: nokia1
[ 1617.796783] musb_hdrc periph: enabled ep5in for int IN, maxpacket 10
[ 1617.796783] musb_hdrc periph: enabled ep4in for bulk IN, maxpacket 512
[ 1617.796813] musb_hdrc periph: enabled ep4out for bulk OUT, maxpacket 512
[ 1617.796905] musb_hdrc periph: enabled ep7in for int IN, maxpacket 16
[ 1617.824737] musb_hdrc periph: enabled ep6in for bulk IN, maxpacket 512
[ 1617.824768] musb_hdrc periph: enabled ep5out for bulk OUT, maxpacket 512
[ 1619.233032] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
[ 1619.233093] hub 1-0:1.0: unable to enumerate USB device on port 1
# Was experimenting with something, ignore the 2 errors above ^
[ 1645.303344] usb 1-1: new high speed USB device using musb_hdrc and address 12
[ 1645.453826] usb 1-1: configuration #1 chosen from 1 choice
[ 1645.551605] scsi2 : SCSI emulation for USB Mass Storage devices
[ 1645.590362] usb-storage: device found at 12
[ 1645.590393] usb-storage: waiting for device to settle before scanning
[ 1645.838378] input: Western Digital  External HDD    as /class/input/input4
# No idea what this ^ is for, SpeedEvil suggested it could be for the LEDs on the drive.
[ 1645.892456] generic-usb 0003:1058:0705.0001: input: USB HID v1.10 Device [Western Digital  External HDD    ] on usb-musb_hdrc-1/input1
[ 1645.893554] usbcore: registered new interface driver usbhid
[ 1645.893615] usbhid: v2.6:USB HID core driver
[ 1650.585540] usb-storage: device scan complete
[ 1650.586639] scsi 2:0:0:0: Direct-Access    WD      3200BEV External 1.75 PQ: 0 ANSI: 0
[ 1650.619903] sd 2:0:0:0: [sda] 625142448 512-byte hardware sectors: (320 GB/298 GiB)
[ 1650.620391] sd 2:0:0:0: [sda] Write Protect is off
[ 1650.620422] sd 2:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 1650.620422] sd 2:0:0:0: [sda] Assuming drive cache: write through
[ 1650.621154] sd 2:0:0:0: [sda] 625142448 512-byte hardware sectors: (320 GB/298 GiB)
[ 1650.621551] sd 2:0:0:0: [sda] Write Protect is off
[ 1650.621582] sd 2:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 1650.621582] sd 2:0:0:0: [sda] Assuming drive cache: write through
[ 1650.621612]  sda: sda1
[ 1650.672180] sd 2:0:0:0: [sda] Attached SCSI disk
[ 2936.905181] usb 1-1: USB disconnect, address 12
[ 2937.256347] usb 1-1: new high speed USB device using musb_hdrc and address 13
[ 2937.405853] usb 1-1: configuration #1 chosen from 1 choice
[ 2937.405883] usb 1-1: new config #1 exceeds power limit by 100mA
[ 2937.435028] scsi3 : SCSI emulation for USB Mass Storage devices
[ 2937.473449] usb 1-1: 200mA is over 100mA budget for port 1!
[ 2937.473480] hub 1-0:1.0: 100mA over power budget!
[ 2937.476623] usb-storage: device found at 13
[ 2937.476623] usb-storage: waiting for device to settle before scanning
[ 2942.476196] usb-storage: device scan complete
[ 2942.477081] scsi 3:0:0:0: Direct-Access    SanDisk  U3 Contour      4.04 PQ: 0 ANSI: 2
[ 2942.477539] scsi 3:0:0:1: CD-ROM            SanDisk  U3 Contour      4.04 PQ: 0 ANSI: 2
# U3 enabled flash drive, the CD-ROM is emulated by the flash drive, it's not an actual CD-ROM, mind you a CD drive might be used with a self powered hub.
[ 2942.510925] sd 3:0:0:0: [sda] 16041617 512-byte hardware sectors: (8.21 GB/7.64 GiB)
[ 2942.511383] sd 3:0:0:0: [sda] Write Protect is off
[ 2942.511413] sd 3:0:0:0: [sda] Mode Sense: 03 00 00 00
[ 2942.511413] sd 3:0:0:0: [sda] Assuming drive cache: write through
[ 2942.516235] sd 3:0:0:0: [sda] 16041617 512-byte hardware sectors: (8.21 GB/7.64 GiB)
[ 2942.516540] sd 3:0:0:0: [sda] Write Protect is off
[ 2942.516540] sd 3:0:0:0: [sda] Mode Sense: 03 00 00 00
[ 2942.516571] sd 3:0:0:0: [sda] Assuming drive cache: write through
[ 2942.516601]  sda: sda1
[ 2942.530303] sd 3:0:0:0: [sda] Attached SCSI removable disk

Making the drive appear in file manager is **** easy, just create a directory in /media and mount the drive/flash to it.

http://i47.tinypic.com/wmkll4.jpg

http://i46.tinypic.com/m82rmq.jpg

http://i48.tinypic.com/1zxbq6g.jpg

egoshin 2010-05-20 00:48

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666802)
[ 1645.838378] input: Western Digital External HDD as /class/input/input4
# No idea what this is ^ is for, SpeedEvil suggested it could be for the LEDs on the drive.

It is a CPU frequency boost on any event from your WD HD.

MohammadAG 2010-05-20 01:03

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by egoshin (Post 666857)
It is a CPU frequency boost on any event from your WD HD.

/class/input/input4, HID, that means it was attached (or a part of it) as an input device.
CPU frequency doesn't change, and HID devices shouldn't alter frequency.
It's most probably the LEDs as SpeedEvil said.
It's also a plain HDD, nothing that should cause 'boost' events.

javispedro 2010-05-20 01:33

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666802)
The echo host > ... part is redundant and doesn't do anything, so it can be left out.

If you're providing your own vbus with an Y-cable, then it surely is, as the only it does now is toggle the twl4030 vbus pump (this is exactly what I was talking about when I said "play your cards well" in my previous post ;P ).

egoshin 2010-05-20 04:25

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666877)
/class/input/input4, HID, that means it was attached (or a part of it) as an input device.
CPU frequency doesn't change, and HID devices shouldn't alter frequency.
It's most probably the LEDs as SpeedEvil said.
It's also a plain HDD, nothing that should cause 'boost' events.

The 'input' driver is used by ondemand cpufreq scaling governor to boost CPU frequency immediately after some input event happens - you press unlock, keyboard, touchpad or power button. Attachment of dynamic USB device pursues the same goal.

EDIT: without it the scaling governor boosts frequency only after 75millisec.

eryx 2010-05-20 07:02

Re: N900 will not allow USB OTG!
 
Can we use WiMax usb modem with this host mode? madwifi drivers theoretically can be easy compiled for N900.

hcm 2010-05-20 07:48

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 666756)
those messages are obtained with high power charger attached , right ?
so nothing special , bme reset 32 s timer 4 times per minute . too often i think but in charge mode any battery savings is nonsense.
bme don't destroy vbus , simply bme have no idea ( and code ) about vbus and host mode status.
code is written only for charging mode not charge or boost vbus

no, there was nothing attached to the USB port. This is also confirmed by the value 0x00 read from the status register (no charge in progress, no charge done).

MohammadAG 2010-05-20 08:32

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by javispedro (Post 666891)
If you're providing your own vbus with an Y-cable, then it surely is, as the only it does now is toggle the twl4030 vbus pump (this is exactly what I was talking about when I said "play your cards well" in my previous post ;P ).

http://i50.tinypic.com/wjtff8.jpg

No Y cable here :)
(The cable was for the HDD, which I tried after testing if echo host is necessary or not)

MohammadAG 2010-05-20 09:50

Re: N900 will not allow USB OTG!
 
http://i48.tinypic.com/2uyr9u1.jpg

Bad quality (10MP cameras these days...), but you get the idea (E: yellow light was solid when the drive was connected)

Code:

[38724.031738] usb 1-1: new high speed USB device using musb_hdrc and address 2
[38724.181701] usb 1-1: configuration #1 chosen from 1 choice
[38724.866882] Initializing USB Mass Storage driver...
[38724.884979] scsi0 : SCSI emulation for USB Mass Storage devices
[38724.892120] usbcore: registered new interface driver usb-storage
[38724.892150] USB Mass Storage support registered.
[38724.916107] usb-storage: device found at 2
[38724.916107] usb-storage: waiting for device to settle before scanning
[38729.997253] usb-storage: device scan complete
[38730.003479] scsi 0:0:0:0: CD-ROM            TSSTcorp CDDVDW SE-T084M  TS01 PQ: 0 ANSI: 0

The drive spun up using the N900's power alone (then it went back to a slow quiet spin), but it was detected using the N900's port solely.
Connected it to the PS3 to get more power (which kicked it back into speed - still though, nothing in /dev)
However it didn't show up as a node in /dev, so I couldn't mount it.

E: Also tried a Wireless-N Wi-Fi USB adapter, it didn't power up but I have two guesses:
1. It's using too much power
2. It causes a kernel panic on my PC, so it might be borked :)

E2: Connecting the AC charger and running the pcsuite-enable.sh script causes the "Connected to USB device" dialog to pop up.

E3: requested...
http://i50.tinypic.com/2s8o8jn.jpg

Code:

[45571.000640] usb 1-1: new full speed USB device using musb_hdrc and address 29
[45571.150421] usb 1-1: configuration #1 chosen from 1 choice
[45571.238159] scsi4 : SCSI emulation for USB Mass Storage devices
[45571.273651] usb-storage: device found at 29
[45571.273681] usb-storage: waiting for device to settle before scanning
[45576.301910] usb-storage: device scan complete
[45576.303314] scsi 4:0:0:0: Direct-Access    Nokia    S60              1.0  PQ: 0 ANSI: 0
[45576.329681] sd 4:0:0:0: [sda] 3964928 512-byte hardware sectors: (2.03 GB/1.89 GiB)
[45576.330291] sd 4:0:0:0: [sda] Write Protect is off
[45576.330291] sd 4:0:0:0: [sda] Mode Sense: 03 00 00 00
[45576.330322] sd 4:0:0:0: [sda] Assuming drive cache: write through
[45576.334014] sd 4:0:0:0: [sda] 3964928 512-byte hardware sectors: (2.03 GB/1.89 GiB)
[45576.334594] sd 4:0:0:0: [sda] Write Protect is off
[45576.334594] sd 4:0:0:0: [sda] Mode Sense: 03 00 00 00
[45576.334625] sd 4:0:0:0: [sda] Assuming drive cache: write through
[45576.334625]  sda:
[45576.712646] sd 4:0:0:0: [sda] Attached SCSI removable disk

http://i48.tinypic.com/2s6lhdy.jpg

E4: requested:
Code:

[48481.302795] input: Microsoft Microsoft� 2.4GHz Transceiver v4.0 as /class/input/input4
[48481.383453] generic-usb 0003:045E:0745.0001: input: USB HID v1.11 Keyboard [Microsoft Microsoft� 2.4GHz Transceiver v4.0] on usb-musb_hdrc-1/input0
[48481.402465] input: Microsoft Microsoft� 2.4GHz Transceiver v4.0 as /class/input/input5
[48481.477203] generic-usb 0003:045E:0745.0002: input: USB HID v1.11 Mouse [Microsoft Microsoft� 2.4GHz Transceiver v4.0] on usb-musb_hdrc-1/input1
[48481.749420] input: Microsoft Microsoft� 2.4GHz Transceiver v4.0 as /class/input/input6
[48481.820953] generic-usb 0003:045E:0745.0003: input: USB HID v1.11 Device [Microsoft Microsoft� 2.4GHz Transceiver v4.0] on usb-musb_hdrc-1/input2
[48481.829223] usbcore: registered new interface driver usbhid
[48481.829315] usbhid: v2.6:USB HID core driver


MohammadAG 2010-05-20 12:04

Re: N900 will not allow USB OTG!
 
1 Attachment(s)
Patch to disable limits on power:
Code:

--- drivers/usb/core/generic.c        2008-12-25 01:26:37.000000000 +0200
+++ ../kernel-2.6.28.patched.working/drivers/usb/core/generic.c        2010-05-19 22:18:33.915723530 +0300
@@ -97,10 +97,10 @@
                  */
 
                /* Rule out configs that draw too much bus current */
-                if (c->desc.bMaxPower * 2 > udev->bus_mA) {
+                /*if (c->desc.bMaxPower * 2 > udev->bus_mA) {
                        insufficient_power++;
                        continue;
-                }
+                }*/
 
                /* When the first config's first interface is one of Microsoft's
                  * pet nonstandard Ethernet-over-USB protocols, ignore it unless
@@ -132,10 +132,10 @@
                        best = c;
        }
 
-        if (insufficient_power > 0)
+        /*if (insufficient_power > 0)
                dev_info(&udev->dev, "rejected %d configuration%s "
                        "due to insufficient available bus power\n",
-                        insufficient_power, plural(insufficient_power));
+                        insufficient_power, plural(insufficient_power));*/
 
        if (best) {
                i = best->desc.bConfigurationValue;

Patch for rx51_defconfig
Code:

--- arch/arm/configs/rx51_defconfig        2010-05-20 14:56:18.000000000 +0300
+++ ../kernel-2.6.28.patched.working/arch/arm/configs/rx51_defconfig        2010-05-20 15:01:24.068032001 +0300
@@ -1324,7 +1324,7 @@
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
-# CONFIG_FRAMEBUFFER_CONSOLE is not set
+CONFIG_FRAMEBUFFER_CONSOLE=y
 # CONFIG_LOGO is not set
 CONFIG_SOUND=y
 # CONFIG_SOUND_OSS_CORE is not set
@@ -1413,8 +1413,6 @@
 CONFIG_USB_DYNAMIC_MINORS=y
 CONFIG_USB_SUSPEND=y
 CONFIG_USB_OTG=y
-CONFIG_USB_OTG_WHITELIST=y
-CONFIG_USB_OTG_BLACKLIST_HUB=y
 CONFIG_USB_MON=y
 # CONFIG_USB_WUSB is not set
 # CONFIG_USB_WUSB_CBAF is not set

.config file has to be changed (use one attached)
Build with make bzImage.

slender 2010-05-20 12:10

Re: N900 will not allow USB OTG!
 
Looks wonderful, but what does these advancements here really mean if we speak just about reading/writing simple usb-stick?

- Do I need to patched kernel?
- What hardware/cables do I need
-- Does it matter how fast / on what order I connect cables+stick
- Is it mounted automatically
-- is fat32 the safest bet?

MohammadAG 2010-05-20 12:33

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by slender (Post 667532)
Looks wonderful, but what does these advancements here really mean if we speak just about reading/writing simple usb-stick?

- Do I need to patched kernel?
- What hardware/cables do I need
-- Does it matter how fast / on what order I connect cables+stick
- Is it mounted automatically
-- is fat32 the safest bet?

- Yes, patches above.
- Only an F-F adapter and the stock USB cable.
- It's just a bug at the moment that requires a connection to a PC first, fixing the driver should make it work without a PC.
- No, not at the moment
- File system doesn't matter, all should work, as long as the N900 supports them

saadgadit 2010-05-20 12:37

Re: N900 will not allow USB OTG!
 
where to copy this config file :D? some howto plz?

MohammadAG 2010-05-20 12:43

Re: N900 will not allow USB OTG!
 
Too early to give out instructions, it's still not fully working (needs a PC connection, needs a voltage boost etc...).

javispedro 2010-05-20 12:45

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 667236)
No Y cable here :)

Then you're experiencing the same that happened to me. twl3040 settings survive a reboot, be careful (as I had unmodified kernel but couldn't reproduce after removing the battery).

saadgadit 2010-05-20 12:46

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 667594)
Too early to give out instructions, it's still not fully working (needs a PC connection, needs a voltage boost etc...).

thnx muhammad :).. u ppl take your time :).. u ppl are doin a marvelous job :).. keep it up :)

joerg_rw 2010-05-20 13:30

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by javispedro (Post 667602)
Then you're experiencing the same that happened to me. twl3040 settings survive a reboot, be careful (as I had unmodified kernel but couldn't reproduce after removing the battery).

The point is: there shouldn't be ANY twl4030 settings, to make hostmode work.
Basically everything accessing twl4030 GAIA is a bug wrt hostmode, no matter if it's the real hostmode or the "fake hostmode" we're talking about here in the past some weeks

blue_led 2010-05-20 15:03

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by hcm (Post 667184)
no, there was nothing attached to the USB port. This is also confirmed by the value 0x00 read from the status register (no charge in progress, no charge done).

for what reason bme read an idle/unused asic ( bq24xxx ) ?
as i understand from specs in charge or boost mode for sustaining those functions, some activity on i2c bus is needed.
if NO CHARGE mode why i2c read / writes activity ?. this useless activity drain the precious battery.
i will look closer on specs for a decent reason.

if vbus sensing for mode selection pop-up is needed instead of pulling status of BQ24k vbus sensing from 4030 via interrupt is preferred.

popup usb mode selection is not in bme or mce . what code is doing this selection ?

MohammadAG 2010-05-20 16:13

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 667838)
popup usb mode selection is not in bme or mce . what code is doing this selection ?

Was just looking for what this is before you posted.
cat'ing the language files shows that Mass storage mode and PC Suite are in hildon-status-bar-usb, which as far as I know is closed source.

e: as for the actual buttons, they're scripts, in /usr/sbin as I mentioned above.
pcsuite-enable.sh for PC suite mode
osso-usb-mass-storage-enable.sh for Mass storage mode.
Same for disabling them (unplugging), just replace enable with disable.

If you're thinking about executing pcsuite-enable.sh to trick it into host mode it won't work, you have to connect it to a real host till the driver is fixed.

blue_led 2010-05-20 16:54

Re: N900 will not allow USB OTG!
 
i wish a new one with:

pc suite mode ( never used )
mass storage
host ( docking station )
printer for photos ( pict bridge )
.....

MohammadAG 2010-05-20 16:56

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 668011)
i wish a new one with:

pc suite mode ( never used )
mass storage
host ( docking station )
printer for photos ( usb-ptp )
.....

Edit the PC suite one and change the string to host mode or something.
Just add the echo H > command to the end of the pcsuite-enable.sh script (NOT tested, but in theory it SHOULD work)

It's quite useless however, since the 'plug into PC' part is still present, which kind of defeats the purpose, again, till the driver is fixed.

qole 2010-05-20 16:57

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 667331)
E: Also tried a Wireless-N Wi-Fi USB adapter, it didn't power up but I have two guesses:
1. It's using too much power
2. It causes a kernel panic on my PC, so it might be borked

My experience with USB WiFi sticks and the N800 is that they need an external power supply to run.


All times are GMT. The time now is 15:09.

vBulletin® Version 3.8.8