maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   [Announce] USB hostmode beta release (https://talk.maemo.org/showthread.php?t=65232)

Régis Amaral 2012-01-02 14:47

Re: [Announce] USB hostmode beta release
 
Hello
I'm trying to use an external webcam on my n900
I need help because I am not able to enumerate the device.
Is not showing up for me / dev/video2
How should I do to make it appear? What are the steps?

If I need to install a driver, as I do that?


(sorry if wrong in English, I used google translate)

blue_led 2012-01-03 18:09

Re: [Announce] USB hostmode beta release
 
here, you are offtopic
maybe you get more considreration on dedicated thread
http://talk.maemo.org/showthread.php?t=65570

pali 2012-01-13 20:00

Re: [Announce] USB hostmode beta release
 
patched ke-recv now can automount usb devices (like sd card), see: http://talk.maemo.org/showpost.php?p...&postcount=152

joerg_rw 2012-01-13 22:45

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pali (Post 1150253)
patched ke-recv now can automount usb devices (like sd card), see: http://talk.maemo.org/showpost.php?p...&postcount=152

You're awesome, I appoint you for honored member of hostmode freemasons :-)

cheers
jOERG

fffffred 2012-01-14 02:14

Re: [Announce] USB hostmode beta release
 
you my friend, are a legend :) is hen going to update automatically? or do we have to manually install?

Estel 2012-01-14 02:15

Re: [Announce] USB hostmode beta release
 
HEN isn't going to update anytime soon, because package maintainer is unreachable. If I'm wrong, fix me.

/Estel

joerg_rw 2012-01-14 16:21

Re: [Announce] USB hostmode beta release
 
H-E-N is the family name of three pieces working together:
a) a set of nasty patches to kernel, to make USB hostmode work. Done by me and Paul, then eventually integrated into powerkernel.
b) some tiny but nifty scripts to handle VBUS 5V. Developed by me.
c) some lean GUI app that allows user to talk to a) and b) to start and stop hostmode. Done by MohammadAG.

New developments like above are mostly kernel or kernel related, and thus will not result in a new version of c):H-E-N GUI. So any update will come with either new powerkernel version, or with new version of CSSU if we get ke-recv into it.
Updates to b) though might/should result in a new updated package of c), as they ship with package c) anyway. Of course you as well can simply copy the better scripts to device, as suggested in http://talk.maemo.org/showthread.php...02#post1023402

I hope this clarifies some confusion about H-E-N :-)

cheers
jOERG

blue_led 2012-01-16 16:38

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pali (Post 1150253)
patched ke-recv now can automount usb devices (like sd card), see: http://talk.maemo.org/showpost.php?p...&postcount=152

i don't know what is "the best, RightWay,.." ke-recv or udev rules.
now, i use for myself an udev rule for automount. because i am lazy* the rule point to a custom variant of original h-e-n mount routine and my actual host script ( v2, not public yet ) don't have any mount call.
for same ( * ) reason cdrom rule ( sr* ) is missing
it look like
Code:

KERNEL=="sd*[1-9]",ACTION=="add",RUN+="/opt/host/mount.sh -M %k"
saved in /etc/udev/rules.d directory as 94-automount.rules
"run" section can be modified to point mmount program and above rule is a start point for what the rule should be.
i prefer this because it's easy to be modified

I propose that the ke-recv to handle battery charging, usb type detection is there and boost check also can be, to trigger charging mode.

pali 2012-01-16 16:51

Re: [Announce] USB hostmode beta release
 
ke-recv is responsible only for mounting devices. it listen to hal events. in fremantle was mounting usb devices disabled (no reason why). I created patch which enable this feature (and fixed some problems)... Why to not use daemon designed for maemo which can do that?

handling battery charging will be done in bq2415x_charger kernel driver, onece I will write it. it will use power_supply interface (so hal and udev will see it)

usb type detection is done in isp.._charger kernel driver (in upstream, not in 2.6.28) which use standard power_supply interface (and hal listen for events)...
I can try to backport it to kernel-power (and test if it is working...)

ivgalvez 2012-01-16 19:14

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by Estel (Post 1150365)
HEN isn't going to update anytime soon, because package maintainer is unreachable. If I'm wrong, fix me.

/Estel

Actually, there is no need to be the maintainer to patch HEN and push a new package to Extras-Devel and, let's face it everyone is using Extras-Devel, the repository system is completely broken.

At least that would be better than having some scripts floating around the thread. There is now a big amount of applications and packages not uploaded to repositories and we shouldn't contribute to that situation.

Estel 2012-01-16 22:22

Re: [Announce] USB hostmode beta release
 
ivgalves, You're right. AFAIK, current HEN works flawlessly with new booston, so joerg_rw could push update to HEN, containing latest flavor of script(s).

/Estel

pali 2012-01-27 10:39

Re: [Announce] USB hostmode beta release
 
Now I have semi-working kernel driver for bq24150 chip for charging battery. I sent it to lkml for comments, see: https://lkml.org/lkml/2012/1/26/519 Driver does not have implemented current sense voltage and termination current sense voltage configuration yet.

So both kernel drivers bq2415x_charger and bq27x00_battery can be replacement for BME.

@joerg_rw:
Can you look my driver?

pali 2012-01-27 16:55

Re: [Announce] USB hostmode beta release
 
Driver update, now boost mode for usb host mode working too :-)

This driver is now included in kp51.

How to use charge:
1. turn off bme:
$ stop bme

2. load module:
$ modprobe power_supply
$ insmod ./bq2415x_charger.ko

3. select correct charge mode:
* none = limit 100mA
* host = usb host/usb charger, limit 500mA
* dedicated = dedicated - wallcharger, unlimited
$ echo host > /sys/class/power_supply/bq24150-0/mode
$ echo dedicated > /sys/class/power_supply/bq24150-0/mode

how to usb host mode:
1. turn off bme
2. connect usb device
3. load module

4. enable host mode (choose hosth, hostl, hostf):
$ echo hosth > /sys/devices/platform/musb_hdrc/mode

5. enable boost mode:
$ echo boost > /sys/class/power_supply/bq24150-0/mode

6. enumerate:
$ echo F > /proc/driver/musb_hdrc

how to stop usb host mode:
$ echo none > /sys/class/power_supply/bq24150-0/mode
$ echo peripheral > /sys/devices/platform/musb_hdrc/mode

how to revert back to bme:
1. make sure that host mode was stopped
2. unload bq2415_charger module:
$ rmmod bq2415_charger
3. start bme:
$ start bme


Now I tested both charging and usb flash disk and both worked. Please note that this driver is experimental and can cause problems!!!

rafael2k 2012-01-27 20:42

Re: [Announce] USB hostmode beta release
 
Good to hear this pali!

Do you people know what hardware is used by the USB in the N9?
How far are we from having USB hostmode for N9?

I can help testing or porting the patch for the N9 kernel.
Btw, where can I find the kernel patches of the USB hostmode work?

Best regards,
Rafael Diniz

Estel 2012-01-27 21:19

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pali (Post 1156614)
3. select correct charge mode:
* none = limit 100mA
* host = usb host/usb charger, limit 500mA
* dedicated = dedicated - wallcharger, unlimited

Sorry if it's stupid question, but shouldn't "dedicated" be limited to 950 mA? shadowjk tested this some time ago, and increasing charging current by just by 100 mA over this limit (from 950 mA to 1050 mA), resulted in dangerous increase in heat-generation (probably, in charging chip).

/Estel

pali 2012-01-27 21:28

Re: [Announce] USB hostmode beta release
 
Sysfs entry mode setting only current limit (6-7bit of register 0x01).

Charge current (4-6bit of register 0x04) is configured by default to 950mA. (so I think you mean this property).

Same configuration is configured by charge21.sh script

avidscavenger 2012-01-30 01:15

Re: [Announce] USB hostmode beta release
 
Another related (and potentially off-topic) comment... could you also implement the 800mA current limit that the chipset provides? I think this is useful for some wall chargers that claim to deliver 1A but actually struggle to do so and end up going into thermal shutdown.

pali 2012-01-30 09:36

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by avidscavenger (Post 1157637)
Another related (and potentially off-topic) comment... could you also implement the 800mA current limit that the chipset provides? I think this is useful for some wall chargers that claim to deliver 1A but actually struggle to do so and end up going into thermal shutdown.

It is implemented. Set mode to none and manually set current_limit to 800. In my driver are implemented all possible configurations supported by bq24150 chip.

vib3 2012-02-07 09:03

Re: [Announce] USB hostmode beta release
 
Hi!

So bq2415x drivers make possible to charge n900 while in hostmode?
I would need to connect my n900 to active usb-hub in hostmode and charge it also while in hostmode.

pali 2012-02-07 10:33

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by vib3 (Post 1161565)
Hi!

So bq2415x drivers make possible to charge n900 while in hostmode?
I would need to connect my n900 to active usb-hub in hostmode and charge it also while in hostmode.

Of course. You need only select correct bq mode.

don_falcone 2012-02-07 13:22

Re: [Announce] USB hostmode beta release
 
I (and Estel, thanks) found issue with enumerating USB Keyboards, please check here in extkbd thread for log + details.

vib3 2012-02-07 18:57

Re: [Announce] USB hostmode beta release
 
Having some problems. Active usb-hub connected to n900 and tried to enumerate hub and charge n900.
Kernel: 2.6.28.10-power49.

$ dmesg
[35922.641937] bq2415x-charger 2-006b: failed setting hook function, automode not supported
[35922.642791] bq2415x-charger 2-006b: driver registred
[35929.941802] bq2415x-charger 2-006b: mode: Host/HUB charger
[35976.746795] bq2415x-charger 2-006b: mode: Boost
[35988.928466] Forced hostmode error: no device attached
[35988.929168] usb usb1: usb resume
[35988.948455] hub 1-0:1.0: hub_resume
[35988.948486] hub 1-0:1.0: port 1: status 0101 change 0001
[35989.057952] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000
[35989.057983] hub 1-0:1.0: port 1, status 0101, change 0000, 12 Mb/s
[35989.120300] Forced hostmode error: a full/low-speed device attached but high-speed mode selected
[35989.182952] usb 1-1: new full speed USB device using musb_hdrc and address 12
[35994.182983] usb 1-1: khubd timed out on ep0in len=0/64
[35999.182983] usb 1-1: khubd timed out on ep0in len=0/64
[36004.182952] usb 1-1: khubd timed out on ep0in len=0/64
[36004.245452] Forced hostmode error: a full/low-speed device attached but high-speed mode selected
[36004.307952] usb 1-1: device descriptor read/64, error -110

Commands used:

$ stop bme
$ modprobe power_supply
$ insmod bq2415x_charger.ko
$ echo host > /sys/class/power_supply/bq24150-0/mode
$ echo hosth > /sys/devices/platform/musb_hdrc/mode
$ echo boost > /sys/class/power_supply/bq24150-0/mode
$ echo F > /proc/driver/musb_hdrc

pali 2012-02-07 19:01

Re: [Announce] USB hostmode beta release
 
This is question for @joerg_rw:
How to correct set-up host mode with charging?

biketool 2012-02-24 12:07

Re: [Announce] USB hostmode beta release
 
Everyone working on this, thanks for the continuing work on h-e-n, something I really value since I don't need to drag a netbook everywhere, and if I read right we can expect soon full OTG!
Please push this as a H-E-N update or new package soon.

Sort of OT but upthread there was mention that 50-80% was optimal battery charge. Can this somehow be set as a soft charge limit profile in some config file for people who are at home or near power and want to preserve the life of a battery at the expense of long run times? If I am going on an airplane or train I could edit it back for 100% to dead. Ideally it would be something you could click in the battery status applet.

joerg_rw 2012-02-25 15:50

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pali (Post 1161813)
This is question for @joerg_rw:
How to correct set-up host mode with charging?

Hi Pali,

there's no setup for charging hostmode. It's simply you don't run booston but rather charge script (please refer to my prev post that explains how to do that). And of course user is then responsible to apply VBUS +5V the right moment when normally H-E-N GUI would start booston, as the VBUS is needed by PHY and musb-core to establish a USB session, and of course it's needed by your USB peripheral for the same reason, even when the peripheral has a dedicated power supply separate from USB. You can think of VBUS as a 1 bit data signal line that tells "start session now" - both host and peripheral are monitoring that VBUS line to sync their USB chat.

cheers
jOERG

joerg_rw 2012-02-25 16:20

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by biketool (Post 1169170)
Everyone working on this, thanks for the continuing work on h-e-n, something I really value since I don't need to drag a netbook everywhere, and if I read right we can expect soon full OTG!
Please push this as a H-E-N update or new package soon.

Hi biketool,
no, there will never be "full OTG" on N900. It's not possible physically, as the needed lines are not connected to the USB receptacle. Anyway what is your special interest in "full OTG"? It only brings HNP (Host Negotiation Protocol - host and peripheral swapping roles on the fly [1]) to USB that I never have seen being used anywhere (SRP seems to work, and ADP.is not supported by N900 hardware anyway even with better circuitry). So what is it you're missing in H-E-N that you hope "full OTG" could deliver?

Quote:

Originally Posted by biketool (Post 1169170)
Sort of OT but upthread there was mention that 50-80% was optimal battery charge. Can this somehow be set as a soft charge limit profile in some config file for people who are at home or near power and want to preserve the life of a battery at the expense of long run times? If I am going on an airplane or train I could edit it back for 100% to dead. Ideally it would be something you could click in the battery status applet.

Yes, that's feasible if you use charge.sh script rather than bme, to keep your battery charged and N900 powered. One of the bytes sent to bq24150 via i2cset defines battery-full-voltage as 4200mV. You of course can change that to a lower voltage, e.g. 4000mV, and thus treat battery nicely.
* Get a modified charge.sh that uses this 4000mV theshold
* stop bme
* charge.sh&
now your battery will kept floating at 4.00V. Alas also hal-addon-bme breaks and thus no more proper info to whole system about battery state and mode (e.g. your battery icon in status applet will not show the correct state and charge, no bat-low warnings, probably no gentle shutdown when you unplug and run flat on battery, etc)
So before unplugging from USB you want to do:
* killall charge.sh; # or 'kill %1' in the shell you did 'charge-sh&", or simply '^C' if you didn't start charge.sh as a background& process
* start bme
and hope for all the rocks fit together again so after a while bme talks to hal-addon-bme and also reports somewhat correct charge state (bme is known to get severely confused on restarts, so don't get scared when it thinks your battery is empty or whatever, it usually will adjust after a few minutes).

If you're honestly interested in this then ping me, I might prepare the modified script, maybe even with a icon for desktop to click on to toggle the states

Anyway, my warning in charge.sh still applies: DO NOT MESS WITH THIS unless you know what you're doing! Even while bq24150 is inherently safe and you can't really make battery explode, you are still messing with I2C bus(ses) that also run to other chip you actually could kill with a "properly" designed I2C command. (I'll not elaborate on this here, for obvious reasons)

cheers
jOERG


[1] http://en.wikipedia.org/wiki/USB_On-The-Go#Protocols

fpp 2012-02-25 16:47

Re: [Announce] USB hostmode beta release
 
Deep in the bowels of this topic there were once a few posts about using USB host to send the N900 's audio signal to an external DAC. Has anyone succeeded in doing this?

biketool 2012-02-25 16:50

Re: [Announce] USB hostmode beta release
 
I had misread upthread that there was a possible hardware hack to connect the ID pin for brave soldering iron jocks. Having full OTG is more for the status, even now h-e-n it just as useful.

joerg_rw 2012-02-26 04:26

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by fpp (Post 1169639)
Deep in the bowels of this topic there were once a few posts about using USB host to send the N900 's audio signal to an external DAC. Has anyone succeeded in doing this?

I guess that's a question for the "problems" thread, not for here. Anyway from here it looks like "plug in USB soundcard, enable hostmode, load drivers (which is the point where things get tricky, not before)"

/j

Estel 2012-02-28 23:03

Re: [Announce] USB hostmode beta release
 
USB gurus, any comment on this?

http://talk.maemo.org/showpost.php?p...6&postcount=55
(Not the MHL part)

/Estel

pigeond 2012-03-07 11:26

Re: [Announce] USB hostmode beta release
 
Hi all.

Just a heads up. I can use a MIDI controller (it's a M-Audio keystation mini 32) with my n900 under sunvox.

Pretty cool!

Thanks for bringing usb host mode to n900!

bocephus 2012-03-12 11:17

Re: [Announce] USB hostmode beta release
 
I'm on KP49 and CSSU Testing, and hostmode works great, except... I get an instant reboot every time I close h-e-n after having used and then removed any peripherals. At startup I get the "Stopping BME" banner, but the log is filled with hundreds of lines like these:
Code:

[61084.316223] power_supply bq27200-0: driver failed to report `time_to_empty_now' property
[61084.316253] power_supply bq27200-0: driver failed to report `time_to_empty_avg' property
[61294.302642] power_supply bq27200-0: driver failed to report `time_to_full_now' property

Battery module problem? Any pointers on how to resolve it?

pali 2012-03-12 13:35

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by bocephus (Post 1178301)
I'm on KP49 and CSSU Testing, and hostmode works great, except... I get an instant reboot every time I close h-e-n after having used and then removed any peripherals. At startup I get the "Stopping BME" banner, but the log is filled with hundreds of lines like these:
Code:

[61084.316223] power_supply bq27200-0: driver failed to report `time_to_empty_now' property
[61084.316253] power_supply bq27200-0: driver failed to report `time_to_empty_avg' property
[61294.302642] power_supply bq27200-0: driver failed to report `time_to_full_now' property

Battery module problem? Any pointers on how to resolve it?

You cannot start BME when battery module bq27x00_battery is loaded. In kernel-power is that module blacklisted. Make sure that you did not enabled it in /etc/modules!!!

Also that message in dmesg log is not error, but only normal warnings (battery chip cannot tell you time when battery will be full - when you not charging battery :D) which will be disabled in kernel-power v50.

bocephus 2012-03-12 14:14

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pali (Post 1178337)
You cannot start BME when battery module bq27x00_battery is loaded. In kernel-power is that module blacklisted. Make sure that you did not enabled it in /etc/modules!!!

Also that message in dmesg log is not error, but only normal warnings (battery chip cannot tell you time when battery will be full - when you not charging battery :D) which will be disabled in kernel-power v50.

Ah, I get it now! Yes I did indeed re-enable it before because I needed the temperature readout. So that's what's conflicting with BME. I get the system reboot because upon exiting h-e-n, BME cannot restart.

Stupid noob mistake. I am not worthy, but I am honored to get help from the master himself! :D

Thanks for everything, pali!

joerg_rw 2012-03-12 20:08

Re: [Announce] USB hostmode beta release
 
please keep in mind that any temperature readout from bq27x00 chip is basically useless for anything. It's just the chip temperature of that chip, which doesn't tell you anything useful about any relevant state of system or battery, since in N900 that chip is NOT inside battery as it's supposed to be, but rather soldered literally somewhere on the mainboard.

/jOERG

stevomanu 2012-03-12 20:25

Re: [Announce] USB hostmode beta release
 
Hey all , just wondering but what sort of thing can be plugged in to the phone once app is installed got correct cables ready to go ...

Is it just memory sticks or all usb devices ??? never really looked into this before ....
many thanks

davdav 2012-03-12 22:15

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pigeond (Post 1175831)
Hi all.

Just a heads up. I can use a MIDI controller (it's a M-Audio keystation mini 32) with my n900 under sunvox.

Pretty cool!

Thanks for bringing usb host mode to n900!

how .. ?
after i connect it to the female female usb i choose high speed then it says file system not available .. i ignore it and go to sunvox then what :
thanks in advance :)

pigeond 2012-03-14 10:53

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by davdav (Post 1178687)
how .. ?
after i connect it to the female female usb i choose high speed then it says file system not available .. i ignore it and go to sunvox then what :
thanks in advance :)

In sunvox, all you have to do is to select your midi controller device in Preferences -> MIDI.

However, before that, you need the alsa midi drivers. I had to compile them myself since they don't come with the n900 kernel packages. I'm using 2.6.28.10-power49 (power kernel).

I just uploaded them to:

http://202.65.223.218/~pigeon/power49-midi-modules.tgz

I also have a shell script that sudo insmod the modules in the right order.

Hope it helps.

davdav 2012-03-14 19:21

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pigeond (Post 1179265)
In sunvox, all you have to do is to select your midi controller device in Preferences -> MIDI.

However, before that, you need the alsa midi drivers. I had to compile them myself since they don't come with the n900 kernel packages. I'm using 2.6.28.10-power49 (power kernel).

how to install them ..
i know how to install a .deb file but i dont know how to install .tgz

Quote:

Originally Posted by pigeond (Post 1179265)
I just uploaded them to:

http://202.65.223.218/~pigeon/power49-midi-modules.tgz
I also have a shell script that sudo insmod the modules in the right order.

thanks again but would u mention how to make it work ? :)

fpp 2012-03-14 20:14

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by pigeond (Post 1179265)
However, before that, you need the alsa midi drivers. I had to compile them myself since they don't come with the n900 kernel packages. I'm using 2.6.28.10-power49 (power kernel).

Hey, since you're knowledgeable about ALSA & stuff... :-)

Would you happen to know what driver(s) would be needed to make the N900 output digital sound through its USB port in host mode, just like a desktop Linux does when connected to an external DAC ?...

TIA,
fp


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

vBulletin® Version 3.8.8