apc-io / apc-firefox-os

Firefox OS on APC
94 stars 28 forks source link

Power off from menu should power off device #14

Closed cmchen6585 closed 10 years ago

cmchen6585 commented 10 years ago
  1. Press Power button and hold until Device menu pop-up
  2. Click Power off

According to console log, system into suspend mode not power off. press power button again, then system wake-up and power down.

Gioyik commented 10 years ago

Could be possible to see the log for this? And if is possible a view of the log cat too?

Regards, Gio

trungnt commented 10 years ago

Here is the log from terminal:

  1. Press the Power button and select "Power off"
[ 5350.546812] request_suspend_state: sleep (0->3) at 5350678123002 (2013-09-27 08:29:08.726795667 UTC)
[ 5350.638846] PM: Syncing filesystems ... done.
[ 5350.650925] Freezing user space processes ... (elapsed 0.01 seconds) done.
[ 5350.669253] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
[ 5350.690998] wmt cir suspend  
[ 5350.694034] android_work: sent uevent USB_STATE=DISCONNECTED
[ 5350.700023] cmos_suspend()
[ 5350.702752] vpp_suspend                                                                                                                                   
[ 5350.706117] [VPP] netlink notify 1,cmd 2,0x0                                                                                                              
[ 5350.710307] [VPP] netlink notify 2,cmd 2,0x0                                                                                                              
[ 5350.714552] {cs8556_set_power_down} cs8556_set_power_down(1)                                                                                              
[ 5350.821619] wmt_nand_suspend                                                                                                                              
[ 5350.824427] wmt_sf_suspend       
  1. Press power button to turn the device on:
[ 5726.625960] gri pmc_wake_sts=0x4000                                                                                   
[ 5726.630693] nand chip device id = 0xd7947e 0x6444ad85                                                                                                     
[ 5726.636887] ## Warning: "wmt.io.nand" not defined                                                                                                         
[ 5726.641504] NAND device: Manufacturer ID: 0xec, Chip ID: 0xd7947e (Samsung K9GBG08U0B)                                                                    
[ 5726.880867] nand flash is not ready                                                                                                                       
[ 5726.884264] Reset err, nand device is not ready                                                                                                           
[ 5726.888783] nand chip device id = 0x0 0xad85                                                                                                              
[ 5726.894232] ## Warning: "wmt.io.nand" not defined                                                                                                         
[ 5726.898845] PLLB=0x18, spec_clk=0x140b0bff                                                                                                                
[ 5726.902918] T1=2, clk1=17, div1=10, Thold=1, tREA=20+delay(9)                                                                                             
[ 5726.908641] T2=1, clk2=29, div2=17, Thold2=1, comp=1                                                                                                      
[ 5726.913579] Tim1=417792 , Tim2=475136                                                                                                                     
[ 5726.917214] T2 is greater and not use                                                                                                                     
[ 5726.920856] nand tadl=14T, divisor set 0xa, NFC_timing=0x1313                                                                                             
[ 5726.926582] wmt_nand_resume OK                                                                                                                            
[ 5726.930029] vpp_resume                                                                                                                                    
[ 5727.037827] {cs8556_set_power_down} cs8556_set_power_down(0)                                                                                              
[ 5727.043437] [HDMI] HDMI plugin,hotplug 1                                                                                                                  
[ 5727.047308] [HDMI] set option(8-HDMI,6-AUDIO) 0x5f1                                                                                                       
[ 5727.053656] cmos_resume()                                                                                                                                 
[ 5727.056210] udc: gri pullup_enable()                                                                                                                      
[ 5727.060104] wmt cir resume                                                                                                                                
[ 5727.065278]  wmt_batt_init                                                                                                                                
[ 5727.385603] android_work: sent uevent USB_STATE=CONNECTED                                                                                                 
[ 5727.449777] usb 3-2: reset low speed USB device number 3 using uhci_hcd                                                                                   
[ 5727.479434] android_usb gadget: high speed config #1: android                                                                                             
[ 5727.485145] android_work: sent uevent USB_STATE=CONFIGURED                                                                                                
[ 5727.843110] usb 1-3: reset high speed USB device number 11 using ehci_hcd                                                                                 
[ 5728.210340] eth0: Link auto-negotiation speed 100M bps full duplex                                                                                        
[ 5728.439820] usb 1-3.2: reset low speed USB device number 12 using ehci_hcd                                                                                
[ 5728.724291] PM: resume of devices complete after 2103.126 msecs                                                                                           
[ 5728.730458] WMT wake up event 4000                                                                                                                        
[ 5728.733947] Restarting tasks ...                                                                                                                          
[ 5728.738188] adb_release                                                                                                                                   
[ 5728.749928] adb_open                                                                                                                                      
[ 5728.753124] done.                                                                                                                                         
[ 5728.758023] rndis ooooo 24                                                                                                                                
[ 5728.771481] rndis xxxxx 24                                                                                                                                
[ 5728.771889] suspend: exit suspend, ret = 0 (2013-09-27 08:29:17.712154001 UTC)                                                                            
[ 5728.771904] active wake lock mmc0_detect                                                                                                                  
[ 5728.974979] request_suspend_state: wakeup (3->0) at 5353312476003 (2013-09-27 08:29:17.915241334 UTC)                                                     
[ 5729.059764] [VPP] netlink notify 1,cmd 2,0x1                                                                                                              
[ 5729.063963] [VPP] netlink notify 2,cmd 2,0x1                                                                                                              
[ 5729.088975] SD0 Host Clock 382812Hz                                                                                                                       
[ 5729.675009] Lch enter wmt_recovery_call.                                                                                                                  
[ 5729.679113] i2c3 shutdown                                                                                                                                 
[ 5729.681661] i2c2 shutdown                                                                                                                                 
[ 5729.684248] i2c1 shutdown                                                                                                                                 
[ 5729.686847] i2c0 shutdown                                                                                                                                 
[ 5729.689440] Power down.      
trungnt commented 10 years ago

This is the logcat output:

  1. Press the power button then click "Power off":
E/FramebufferNativeWindow(   71): fb buffer 1 allocation failed w=1280, h=720, err=Out of memory
I/Gonk    (   71): Setting nice for pid 268 to 18
I/Gonk    (   71): Changed nice for pid 268 from 0 to 18.
E/profiler(  268): Registering start signal
E/GeckoConsole(  268): [JavaScript Warning: "Unknown property '-moz-align-self'.  Declaration dropped." {file: "resource://gre-resources/ua.css" line: 44}]
I/Gecko   (  268): ###################################### forms.js loaded
I/Gecko   (  268): ############################### browserElementPanning.js loaded
I/Gecko   (  268): ######################## BrowserElementChildPreload.js loaded
I/lights  (   71): set_light_backlight: state->color=0xff000000, brightness = 0
I/power   (   71): *** set_screen_state 0
I/Gecko   (   71): 1380271012552    Marionette  INFO    onStopListening for Marionette dummy socket, code 2147500036
  1. Press power button to turn device on:
adb logcat
- waiting for device -
I/DEBUG   (   74): debuggerd: Sep 27 2013 11:29:05
I/Vold    (   69): Vold 2.1 (the revenge) firing up
D/Vold    (   69): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)
D/Vold    (   69): Volume udisk state changing -1 (Initializing) -> 0 (No-Media)
I/Netd    (   73): Netd 1.0 starting
I/        (   75): ServiceManager: 0x6ca910
I/        (   76): ServiceManager: 0x11dc958
I/AudioFlinger(   76): Loaded primary audio interface from LEGACY Audio HW HAL (audio)
I/AudioFlinger(   76): Using 'LEGACY Audio HW HAL' (audio.primary) as the primary audio interface
I/AudioFlinger(   76): Loaded a2dp audio interface from A2DP Audio HW HAL (audio)
I/CameraService(   76): CameraService started (pid=76)
E/CameraService(   76): Could not load camera HAL module
D/AudioHardwareALSA(   76): openOutputStream called for devices: 0x00000002
D/ALSAModule(   76): open called for devices 00000002 in mode 0...
I/ALSAModule(   76): Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
I/AudioFlinger(   76): AudioFlinger's thread 0x11f5748 ready to run
W/AudioFlinger(   76): Thread AudioOut_1 cannot connect to the power manager service
D/ALSAModule(   76): route called for devices 00000002 in mode 0...
I/AudioPolicyService(   76): Loaded audio policy from LEGACY Audio Policy HAL (audio_policy)
I/power   (   71): *** set_screen_state 1
I/gralloc (   71): wmt.gralloc.param=[32]
I/gralloc (   71): using (fd=12)
I/gralloc (   71): id           = gefb
I/gralloc (   71): xres         = 1280 px
I/gralloc (   71): yres         = 720 px
I/gralloc (   71): xres_virtual = 1280 px
I/gralloc (   71): yres_virtual = 2160 px
I/gralloc (   71): bpp          = 32
I/gralloc (   71): r            = 16:8
I/gralloc (   71): g            =  8:8
I/gralloc (   71): b            =  0:8
I/gralloc (   71): width        = 203 mm (160.157639 dpi)
I/gralloc (   71): height       = 114 mm (160.421051 dpi)
I/gralloc (   71): refresh rate = 59.95 Hz
E/profiler(   71): Registering start signal
W/Gonk    (   71): Could not open boot animation
I/Gonk    (   71): Setting nice for pid 71 to 0
I/Gonk    (   71): Changed nice for pid 71 from 0 to 0.
I/Gecko   (   71): 1380270989577    Marionette  INFO    MarionetteComponent loaded
I/Gecko   (   71): 1380270989609    Marionette  INFO    marionette enabled
I/Gonk    (   71): Socket open for RIL
I/VolumeManager(   71): changing state from 'Uninitialized' to 'Starting'
I/VolumeManager(   71): Connected to vold
D/VoldCmdListener(   69): volume list
I/VolumeManager(   71): Volume sdcard: changing state from Init to NoMedia (1 observers)
I/VolumeManager(   71): Volume udisk: changing state from Init to NoMedia (1 observers)
I/VolumeManager(   71): changing state from 'Starting' to 'Volumes Ready'
I/AutoMounter(   71): UpdateState: umsAvail:1 umsEnabled:0 mode:0 usbCablePluggedIn:1 tryToShare:0
I/AutoMounter(   71): UpdateState: Volume sdcard is NoMedia and missing
I/AutoMounter(   71): UpdateState: Volume udisk is NoMedia and missing
I/Gonk    (   71): Connected to netd
D/EventHub(   71): No input device configuration file found for device 'Apple, Inc Apple Keyboard'.
E/Sensors (   71): couldn't find 'g-sensor' input device
E/Sensors (   71): Couldn't open /dev/g-sensor (No such file or directory)
E/Sensors (   71): Get LSG fail!
E/Sensors (   71): WMT_IOCTL_APP_SET_AFLAG failed (Bad file number)
I/EventHub(   71): New device: id=1, fd=44, path='/dev/input/event5', name='Apple, Inc Apple Keyboard', classes=0x80000001, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false
D/EventHub(   71): No input device configuration file found for device 'Apple, Inc Apple Keyboard'.
I/EventHub(   71): New device: id=2, fd=47, path='/dev/input/event4', name='Apple, Inc Apple Keyboard', classes=0x80000003, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false
D/EventHub(   71): No input device configuration file found for device 'USB Optical Mouse'.
I/EventHub(   71): New device: id=3, fd=48, path='/dev/input/event3', name='USB Optical Mouse', classes=0x80000008, configuration='', keyLayout='', keyCharacterMap='', builtinKeyboard=false
E/EventHub(   71): could not get driver version for /dev/input/mouse0, Not a typewriter
D/EventHub(   71): No input device configuration file found for device 'kpadPower'.
I/EventHub(   71): New device: id=4, fd=49, path='/dev/input/event2', name='kpadPower', classes=0x1, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false
D/EventHub(   71): No input device configuration file found for device 'rmtctl'.
I/EventHub(   71): New device: id=5, fd=50, path='/dev/input/event1', name='rmtctl', classes=0x1, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false
D/EventHub(   71): No input device configuration file found for device 'keypad'.
I/EventHub(   71): New device: id=6, fd=51, path='/dev/input/event0', name='keypad', classes=0x1, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false
E/EventHub(   71): could not get driver version for /dev/input/mice, Not a typewriter
I/InputReader(   71): Device added: id=6, name='keypad', sources=0x00000101
I/InputReader(   71): Device added: id=5, name='rmtctl', sources=0x00000101
I/InputReader(   71): Device added: id=4, name='kpadPower', sources=0x00000101
I/InputReader(   71): Device added: id=3, name='USB Optical Mouse', sources=0x00002002
I/InputReader(   71): Device added: id=2, name='Apple, Inc Apple Keyboard', sources=0x00000101
I/InputReader(   71): Device added: id=1, name='Apple, Inc Apple Keyboard', sources=0x00000101
E/GeckoConsole(   71): [JavaScript Warning: "Unknown property '-moz-align-self'.  Declaration dropped." {file: "resource://gre-resources/ua.css" line: 44}]
I/Gecko   (   71): 1380270990209    Marionette  INFO    marionette initializing at final-ui-startup
I/Gecko   (   71): 1380270990300    Marionette  INFO    marionette-actors.js loaded
I/Gecko   (   71): 1380270990301    Marionette  INFO    Platform detected is wmid
I/Gecko   (   71): 1380270990304    Marionette  INFO    marionette listener opened
W/bluedroid(   71): open(/sys/class/rfkill/rfkill0/type) failed: No such file or directory (2)
I/FMRadio (   71): FMRadio is initialized.
W/AudioFlinger(   76): Thread AudioOut_1 cannot connect to the power manager service
I/GeckoDump(   71): exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsICrashReporter.annotateCrashReport]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: chrome://browser/content/shell.js :: <TOP_LEVEL> :: line 224"  data: no]
I/Gecko   (   71): ###################################### forms.js loaded
I/Gecko   (   71): ############################### browserElementPanning.js loaded
I/Gecko   (   71): ######################## BrowserElementChildPreload.js loaded
I/Gecko   (   71): [AccessFu] INFO attach
E/GeckoConsole(   71): [JavaScript Warning: "Error in parsing value for 'transform'.  Declaration dropped." {file: "app://system.gaiamobile.org/style/list_menu/list_menu.css" line: 3}]
I/Gecko   (   71): ###################################### forms.js loaded
I/Gecko   (   71): ############################### browserElementPanning.js loaded
I/Gecko   (   71): ######################## BrowserElementChildPreload.js loaded
E/Sensors (   71): update delay fail!
I/Gecko   (   71): UpdatePrompt: Forcing update check
I/Gecko   (   71): *** AUS:SVC Checker: checkForUpdates, force: true
E/GeckoConsole(   71): AUS:SVC Checker: checkForUpdates, force: true
I/Gecko   (   71): UpdatePrompt: onUpdateCheckStart (undefined)
I/Gecko   (   71): *** AUS:SVC Checker:getUpdateURL - update URL: http://apc.io/media/apc/library/8950-A/B2GOTA/update.xml?force=1
E/GeckoConsole(   71): AUS:SVC Checker:getUpdateURL - update URL: http://apc.io/media/apc/library/8950-A/B2GOTA/update.xml?force=1
I/Gecko   (   71): *** AUS:SVC gCanCheckForUpdates - able to check for updates
E/GeckoConsole(   71): AUS:SVC gCanCheckForUpdates - able to check for updates
I/Gecko   (   71): *** AUS:SVC Checker:checkForUpdates - sending request to: http://apc.io/media/apc/library/8950-A/B2GOTA/update.xml?force=1
E/GeckoConsole(   71): AUS:SVC Checker:checkForUpdates - sending request to: http://apc.io/media/apc/library/8950-A/B2GOTA/update.xml?force=1
I/GeckoDump(   71): XXX FIXME : Got a mozContentEvent: force-update-check
I/lights  (   71): open_lights ... [backlight]
I/lights  (   71): open_lights ... [keyboard]
I/lights  (   71): open_lights ... [buttons]
I/lights  (   71): open_lights ... [battery]
I/lights  (   71): open_lights ... [notifications]
I/lights  (   71): open_lights ... [attention]
I/lights  (   71): open_lights ... [bluetooth]
I/lights  (   71): open_lights ... [wifi]
I/lights  (   71): set_light_backlight: state->color=0xffffffff, brightness = 255
E/lights  (   71): write_int failed to open /sys/class/leds/button-backlight/brightness
I/power   (   71): *** set_screen_state 1
I/GeckoDump(   71): XXX FIXME : Got a mozContentEvent: system-message-listener-ready
I/Gecko   (   71): Logging GL tracing output to /system/b2g/firefox.trace
I/Gecko   (   71): Attempting load of /data/local/egltrace.so
I/Gecko   (   71): Attempting load of libEGL.so
D/libEGL  (   71): loaded /system/lib/egl/libEGL_mali.so
D/libEGL  (   71): loaded /system/lib/egl/libGLESv1_CM_mali.so
D/libEGL  (   71): loaded /system/lib/egl/libGLESv2_mali.so
W/        (   71): hwcomposer module not found
E/HWComposer(   71): Failed to initialize hwc
E/GeckoConsole(   71): OpenGL LayerManager Initialized Succesfully.
E/GeckoConsole(   71): Version: OpenGL ES 2.0
E/GeckoConsole(   71): Vendor: ARM
E/GeckoConsole(   71): Renderer: Mali-400 MP
E/GeckoConsole(   71): FBO Texture Target: TEXTURE_2D
I/Gonk    (   71): Setting nice for pid 215 to 18
I/Gonk    (   71): Changed nice for pid 215 from 0 to 18.
I/Gecko   (   71): *** AUS:SVC Checker:onProgress - 466/466
E/GeckoConsole(   71): AUS:SVC Checker:onProgress - 466/466
I/Gecko   (   71): *** AUS:SVC Creating UpdateService
E/GeckoConsole(   71): AUS:SVC Creating UpdateService
I/Gecko   (   71): *** AUS:SVC Checker:onLoad - request completed downloading document
E/GeckoConsole(   71): AUS:SVC Checker:onLoad - request completed downloading document
I/Gecko   (   71): *** AUS:SVC Checker:getUpdateURL - update URL: http://apc.io/media/apc/library/8950-A/B2GOTA/update.xml?force=1
E/GeckoConsole(   71): AUS:SVC Checker:getUpdateURL - update URL: http://apc.io/media/apc/library/8950-A/B2GOTA/update.xml?force=1
I/Gecko   (   71): *** AUS:SVC Checker:onLoad - number of updates available: 1
E/GeckoConsole(   71): AUS:SVC Checker:onLoad - number of updates available: 1
I/Gecko   (   71): *** AUS:SVC UpdateManager:_loadXMLFileIntoArray: XML file does not exist
E/GeckoConsole(   71): AUS:SVC UpdateManager:_loadXMLFileIntoArray: XML file does not exist
I/Gecko   (   71): UpdatePrompt: Setting gecko.updateStatus: check-complete
I/lights  (   71): set_light_backlight: state->color=0xff808080, brightness = 128
I/lights  (   71): set_light_backlight: state->color=0xff8a8a8a, brightness = 138
I/lights  (   71): set_light_backlight: state->color=0xff949494, brightness = 148
I/lights  (   71): set_light_backlight: state->color=0xff9e9e9e, brightness = 158
I/lights  (   71): set_light_backlight: state->color=0xffa8a8a8, brightness = 168
I/lights  (   71): set_light_backlight: state->color=0xffb2b2b2, brightness = 178
I/lights  (   71): set_light_backlight: state->color=0xffbcbcbc, brightness = 188
I/GeckoDump(   71): XXX FIXME : Got a mozContentEvent: accessibility-screenreader
I/lights  (   71): set_light_backlight: state->color=0xffc6c6c6, brightness = 198
I/lights  (   71): set_light_backlight: state->color=0xffd0d0d0, brightness = 208
I/lights  (   71): set_light_backlight: state->color=0xffdadada, brightness = 218
I/lights  (   71): set_light_backlight: state->color=0xffe4e4e4, brightness = 228
I/lights  (   71): set_light_backlight: state->color=0xffeeeeee, brightness = 238
I/lights  (   71): set_light_backlight: state->color=0xfff8f8f8, brightness = 248
I/lights  (   71): set_light_backlight: state->color=0xffffffff, brightness = 255
I/GeckoDump(   71): Opps, bogus FTU manifest.
I/Gonk    (   71): Setting nice for pid 215 to 1
I/Gonk    (   71): Changed nice for pid 215 from 18 to 1.
E/profiler(  215): Registering start signal
E/GeckoConsole(  215): [JavaScript Warning: "Unknown property '-moz-align-self'.  Declaration dropped." {file: "resource://gre-resources/ua.css" line: 44}]
I/Gecko   (  215): ###################################### forms.js loaded
I/Gecko   (  215): ############################### browserElementPanning.js loaded
I/Gecko   (  215): ######################## BrowserElementChildPreload.js loaded
E/GeckoConsole(  215): [JavaScript Warning: "Error in parsing value for 'font-weight'.  Declaration dropped." {file: "app://homescreen.gaiamobile.org/style/grid.css" line: 193}]
E/GeckoConsole(  215): [JavaScript Warning: "Unknown property 'pointer-event'.  Declaration dropped." {file: "app://homescreen.gaiamobile.org/style/landing.css" line: 73}]
I/Gecko   (   71): UpdatePrompt: appsUpdated: 2 apps to update
I/IdleService(   71): Setting timer a day from now
E/FramebufferNativeWindow(   71): fb buffer 1 allocation failed w=1280, h=720, err=Out of memory
I/Gonk    (   71): Setting nice for pid 268 to 18
I/Gonk    (   71): Changed nice for pid 268 from 0 to 18.
E/profiler(  268): Registering start signal
E/GeckoConsole(  268): [JavaScript Warning: "Unknown property '-moz-align-self'.  Declaration dropped." {file: "resource://gre-resources/ua.css" line: 44}]
I/Gecko   (  268): ###################################### forms.js loaded
I/Gecko   (  268): ############################### browserElementPanning.js loaded
I/Gecko   (  268): ######################## BrowserElementChildPreload.js loaded
I/lights  (   71): set_light_backlight: state->color=0xff000000, brightness = 0
I/power   (   71): *** set_screen_state 0
I/Gecko   (   71): 1380271012552    Marionette  INFO    onStopListening for Marionette dummy socket, code 2147500036
I/lights  (   71): set_light_backlight: state->color=0xffffffff, brightness = 255
I/power   (   71): *** set_screen_state 1
I/AutoMounter(   71): UpdateState: umsAvail:1 umsEnabled:0 mode:0 usbCablePluggedIn:1 tryToShare:0
I/AutoMounter(   71): UpdateState: Volume sdcard is NoMedia and missing
I/AutoMounter(   71): UpdateState: Volume udisk is NoMedia and missing
I/AutoMounter(   71): UpdateState: umsAvail:1 umsEnabled:0 mode:0 usbCablePluggedIn:1 tryToShare:0
I/AutoMounter(   71): UpdateState: Volume sdcard is NoMedia and missing
I/AutoMounter(   71): UpdateState: Volume udisk is NoMedia and missing

Cheers!

kadamski commented 10 years ago

Is this issue still present? I have no way to confirm this (I don't have the device) but I believe it's because setting navigator.mozPower.screenEnabled = false; in turnScreenOff() function in gaia/apps/system/js/screen_manager.js. It calls SetScreenEnabled in gecko/dom/power/PowerManager.cpp which in turn calls SetScreenEnabled in gecko/hal/gonk/GonkHal.cpp which runs set_screen_state(0) from hardware/libhardware_legacy/power/power.c. This ultimately writes "mem" to /sys/power/state forcing system going to suspend. All this is called before actual power off in _actualPowerOff() function in gaia/apps/system/js/sleep_menu.js. The same function turning off the screen is called before reboot, however, and I believe there is no such problem when rebooting, right?

trungnt commented 10 years ago

@kadamski: thank you! this seem does not happen anymore. We'll verify it carefully :)

kadamski commented 10 years ago

@trungnt: you mean it doesn't happen anymore without any change in the code or when you remove the line from screen_manager.js file?

trungnt commented 10 years ago

@kadamski: yep, without any change: I tried with both gaia from our repo (the official one with some of our patches) + the official one (https://git.mozilla.org/releases/gaia.git :: master) and they both shutdown the system now.

kadamski commented 10 years ago

Ok, that's great and strange at the same time. I'm not really sure why it's like that since judging from the code it should write "mem" to /sys/power/state. When I do this manually on FirefoxOS phone (echo "mem" > /sys/power/state), it won't suspend the phone so maybe this is why it's working.

So kernel was not changed and the "fix" was somewhere in GAIA, not GECKO/GONK?

trungnt commented 10 years ago

Hi @kadamski, Sorry for the late reply, I was busy with some bugs. So for this,

trungnt commented 10 years ago

Here is the console log [ 74.857079] rndis xxxxx 24
[ 102.337496] Lch enter wmt_recovery_call.
[ 102.341579] i2c3 shutdown
[ 102.344130] i2c2 shutdown
[ 102.346714] i2c1 shutdown
[ 102.349313] i2c0 shutdown
[ 102.351914] Power down.

And here is the relate logcat: I/GeckoDump( 69): ===== sleep_menu.js ==> startPowerOff(false) E/Profiler( 69): BPUnw: [1 total] thread_unregister_for_profiling(me=0x49e2e0) (NOT REGISTERED) I/PowerManagerService( 69): Call to virtual nsresult mozilla::dom::power::PowerManagerService::PowerOff(). The JS stack is: I/PowerManagerService( 69): 0 sm_actualPowerOff(isReboot = false) ["app://system.gaiamobile.org/js/sleep_menu.js":357] I/PowerManagerService( 69): this = [object Object] I/PowerManagerService( 69): 1 nextAnimation(e = [object AnimationEvent]) ["app://system.gaiamobile.org/js/sleep_menu.js":343] I/PowerManagerService( 69): this = [object HTMLDivElement] I/PowerManagerService( 69): I/Gecko ( 69): 1392968857522 Marionette INFO onStopListening for Marionette dummy socket, code 2147500036 E/Profiler( 69): BPUnw: [1 total] thread_unregister_for_profiling(me=0x49e9b0) (NOT REGISTERED)

kadamski commented 10 years ago

@trungnt: Thank you for information. Reading the code it seemd that startPowerOff() will alsways call screen_manager.js::turnScreenOff() (it's called unconditionally in sleep_menu.js::_actualPowerOff(). There is, however, a check at the beginning of turnScreenOff():

if (!this.screenEnabled)                                                                                   
  return false; 

So it may terminate before setting navigator.mozPower.screenEnabled = false. It would be interesting to see if calling this manually would suspend the device. Either way, the most important thing is that it's working correctly now.

trungnt commented 10 years ago

@kadamski: Thank you, may be we are referring to difference code. Our code is here: https://github.com/apc-io/apc_b2g_gaia/blob/apc8950-master/apps/system/js/sleep_menu.js, there's no call to turnScreenOff in this file.

kadamski commented 10 years ago

@trungnt: And all is clear now. This was fixed in this commit:

https://github.com/apc-io/apc_b2g_gaia/commit/f9c81ec410b633d47311f9d4e9bb914401a6b753

trungnt commented 10 years ago

Cool, this can be closed now :)