diff --git a/mbtk/mbtk_gnssd/gnss_main.c b/mbtk/mbtk_gnssd/gnss_main.c
index 772cf21..1966855 100755
--- a/mbtk/mbtk_gnssd/gnss_main.c
+++ b/mbtk/mbtk_gnssd/gnss_main.c
@@ -85,9 +85,12 @@
         goto check_fail;
     }
 
-    if(strcmp(argv[3], "0") && strcmp(argv[3], "1")) {
+#if 0
+    int init_mode = atoi(argv[3]);
+    if(((GNSS_PRINT_PORT_UART1 | GNSS_PRINT_PORT_USB_NMEA | GNSS_PRINT_PORT_USB_AT | GNSS_PRINT_PORT_TTY_AT) & init_mode) != init_mode) {
         goto check_fail;
     }
+#endif
 
     return 0;
 check_fail:
@@ -97,34 +100,73 @@
 
 static int gnss_ports_open(uint32 print_port)
 {
-    if(print_port & GNSS_PRINT_PORT_TTY_AT) {
-        if(gnss_pty_open(&gnss_pty_master_fd, &gnss_pty_slave_fd, GNSS_PORT_PTY)) {
-            return GNSS_ERR_OPEN_DEV;
+    // TTY AT change.
+    if((gnss_info.print_port & GNSS_PRINT_PORT_TTY_AT) != (print_port & GNSS_PRINT_PORT_TTY_AT)) {
+        if(print_port & GNSS_PRINT_PORT_TTY_AT) { // Open
+            if(gnss_pty_open(&gnss_pty_master_fd, &gnss_pty_slave_fd, GNSS_PORT_PTY)) {
+                return GNSS_ERR_OPEN_DEV;
+            }
+            LOGD("Open PTY port success.");
+        } else { // Close
+            if(gnss_pty_slave_fd > 0) {
+                close(gnss_pty_slave_fd);
+                gnss_pty_slave_fd = -1;
+                unlink(GNSS_PORT_PTY);
+            }
+            LOGD("Close PTY port success.");
         }
-        LOGD("Open PTY port success.");
     }
 
-    if(print_port & GNSS_PRINT_PORT_USB_AT) {
-        if((gnss_usb_at_port_fd = gnss_port_open(GNSS_PORT_USB_AT, O_RDWR | O_NONBLOCK | O_NOCTTY, 115200, FALSE)) <= 0) {
-            return GNSS_ERR_OPEN_DEV;
+    // USB AT change.
+    if((gnss_info.print_port & GNSS_PRINT_PORT_USB_AT) != (print_port & GNSS_PRINT_PORT_USB_AT)) {
+        if(print_port & GNSS_PRINT_PORT_USB_AT) { // Open
+            if((gnss_usb_at_port_fd = gnss_port_open(GNSS_PORT_USB_AT, O_RDWR | O_NONBLOCK | O_NOCTTY, 115200, FALSE)) <= 0) {
+                return GNSS_ERR_OPEN_DEV;
+            }
+            LOGD("Open USB AT port success.");
+        } else { // Close
+            if(gnss_usb_at_port_fd > 0) {
+                close(gnss_usb_at_port_fd);
+                gnss_usb_at_port_fd = -1;
+            }
+            LOGD("Close USB AT port success.");
         }
-        LOGD("Open USB AT port success.");
     }
 
-    if(print_port & GNSS_PRINT_PORT_USB_NMEA) {
-        if((gnss_usb_nmea_port_fd = gnss_port_open(GNSS_PORT_USB_NMEA, O_RDWR | O_NONBLOCK | O_NOCTTY, 115200, FALSE)) <= 0) {
-            return GNSS_ERR_OPEN_DEV;
+    // USB NMEA change.
+    if((gnss_info.print_port & GNSS_PRINT_PORT_USB_NMEA) != (print_port & GNSS_PRINT_PORT_USB_NMEA)) {
+        if(print_port & GNSS_PRINT_PORT_USB_NMEA) { // Open
+            if((gnss_usb_nmea_port_fd = gnss_port_open(GNSS_PORT_USB_NMEA, O_RDWR | O_NONBLOCK | O_NOCTTY, 115200, FALSE)) <= 0) {
+                return GNSS_ERR_OPEN_DEV;
+            }
+            LOGD("Open USB NMEA port success.");
+        } else { // Close
+            if(gnss_usb_nmea_port_fd > 0) {
+                close(gnss_usb_nmea_port_fd);
+                gnss_usb_nmea_port_fd = -1;
+            }
+            LOGD("Close USB NMEA port success.");
         }
-        LOGD("Open USB NMEA port success.");
     }
 
-    if(print_port & GNSS_PRINT_PORT_UART1) {
-        if((gnss_uart_at_port_fd = gnss_port_open(GNSS_PORT_UART_AT, O_RDWR | O_NONBLOCK | O_NOCTTY, 115200, TRUE)) <= 0) {
-            return GNSS_ERR_OPEN_DEV;
+    // Uart AT change.
+    if((gnss_info.print_port & GNSS_PRINT_PORT_UART1) != (print_port & GNSS_PRINT_PORT_UART1)) {
+        if(print_port & GNSS_PRINT_PORT_UART1) { // Open
+            if((gnss_uart_at_port_fd = gnss_port_open(GNSS_PORT_UART_AT, O_RDWR | O_NONBLOCK | O_NOCTTY, 115200, TRUE)) <= 0) {
+                return GNSS_ERR_OPEN_DEV;
+            }
+            LOGD("Open UART AT port success.");
+        } else { // Close
+            if(gnss_uart_at_port_fd > 0) {
+                close(gnss_uart_at_port_fd);
+                gnss_uart_at_port_fd = -1;
+            }
+            LOGD("Close UART AT port success.");
         }
-        LOGD("Open UART AT port success.");
     }
 
+    gnss_info.print_port = print_port;
+
     return GNSS_ERR_OK;
 }
 
@@ -156,6 +198,8 @@
         unlink(GNSS_PORT_PTY);
     }
 
+    gnss_info.print_port = 0;
+
     return 0;
 }
 
@@ -564,7 +608,16 @@
 {
     if(gnss_info.state != GNSS_STATE_CLOSE) {
         LOGW("GNSS not close:%d", gnss_info.state);
-        return GNSS_ERR_OK;
+        if(gnss_info.state == GNSS_STATE_READY) {
+            LOGD("Reset print port : %d -> %d", gnss_info.print_port, print_port);
+            if(gnss_info.print_port != print_port) {
+                return gnss_ports_open(print_port);
+            } else {
+                return GNSS_ERR_OK;
+            }
+        } else {
+            return GNSS_ERR_OK;
+        }
     }
 
     int ret = 0;
@@ -658,11 +711,10 @@
 
     // GNSS is ready, NMEA can print from uart.
     gnss_info.state = GNSS_STATE_READY;
-    gnss_info.print_port = print_port;
 
     LOGD("GNSS open success.");
 
-    return gnss_ports_open(gnss_info.print_port);
+    return gnss_ports_open(print_port);
 
 exit_with_dev_close:
     if(gnss_info.gnss_dev_close()) {
@@ -826,7 +878,7 @@
 }
 
 
-// mbtk_gnssd 6228 /dev/ttyS2 baud 0/1
+// mbtk_gnssd 6228 /dev/ttyS2 baud 0/1 <port_type>
 int main(int argc, char *argv[])
 {
     mbtk_log_init("radio", GNSS_TAG);
@@ -902,10 +954,16 @@
     LOGD("GNSS : %s, Device: %s", argv[1], gnss_info.dev_name);
     // Auto open gnss.
     if(gnss_info.auto_open) {
-        if(gnss_init(0)) { // No print to any port.
-            LOGE("gnss_init() fail.");
-            return -1;
+        int init_mode = atoi(argv[3]);
+        if(((GNSS_PRINT_PORT_UART1 | GNSS_PRINT_PORT_USB_NMEA | GNSS_PRINT_PORT_USB_AT | GNSS_PRINT_PORT_TTY_AT) & init_mode) != init_mode) {
+            init_mode = 0;
         }
+        if(gnss_init((uint32)init_mode)) {
+            LOGE("gnss_init() fail.");
+            // return -1;
+        }
+    } else {
+        gnss_info.print_port = 0;
     }
 
     // Init ubus and waitting IPC commands.
