I meant it didn't worked, didn't create the hotspot.
About your code, it creates the hotspot now, I just tweaked two or three lines, this one works. I can't start commenting ap-hotspot here and there to find the difference, sorry, at least not today. The "stop" was calling setwl which calls...