RTL819SU not working with ifup (needs ifup-dhcp first)

After spending quite some time on this, I have narrowed it down to:

Adapter works OK with NetworkManager
Adapter works OK with ifup if I run iwconfig after ifup has finished

It eppears to be linked to another thread Problème de réseau wifi / Network manager in that dhcp needs to be running. (So it may be a ‘feature’ of RTL819 adaptors)

So I’ve finally worked out that I need to start dhcp first.
*
ifup wlan0* gives me:

    wlan0     name: RTL8191S WLAN Adapter
command 'iwconfig wlan0 key off' returned
 Error for wireless request "Set Encode" (8B2A) :
    SET failed on device wlan0 ; Network is down.
command 'iwconfig wlan0 key open s:#############' returned
 Error for wireless request "Set Encode" (8B2A) :
    SET failed on device wlan0 ; Network is down.
Starting DHCP4 client on wlan0. . . . . . . .  
    wlan0     DHCP4 continues in background

ifup-dhcp wlan0; ifup wlan0 gives me

http://forums.opensuse.org/other-languages/francais-french/aide-et-support/aide-generale/443636-probleme-de-reseau-wifi-network-manager-2.html

My Question is how can I configure my system to do this (elegantly) automatically?

I would appreciate any assistance
Thanks in anticipation

Addendum

Nothing to do with dhcp. Running ip link set up dev wlan0 before ifup also does the trick.

So for now I can add this line to ifup-wireless (before the run_iw_tool config key off line). And my network should start up without intervention …

Didn’t realise the relevance of this post updated firmware for broadcom 4318 now have no wireless at all, so got the source from Realtek (just to see what’s involved).

Interestingly, theres a .ppt in the pack which suggest that ifconfig wlan0 up needs to be run before iwconfig.

Also, I’ve noticed on my laptop (Broadcom 4318) that it used (11.1) to complain similarly (but not anymore - 11.3) about iwconfig wlan0 key off.

I’d be interested to know if any other RTL819 users are having similar experiences … or even not?