Loading py393/imgsrv.py 100644 → 100755 +10 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import time import socket import shutil import sys import subprocess path="/www/pages/img.jpeg" PORT=8888 Loading Loading @@ -95,6 +96,9 @@ if ((not acquisition_parameters["bayer"] is None) and ibayer ^= 2 acquisition_parameters["bayer"] = str(ibayer) #restart compressor communicate(PORT, "compressor_control all 1 None None None None None") cmd_str = "jpeg_acquire_write %s %s %s %s %s %s %s %s %s %s %s %s %s"%( str(acquisition_parameters["file_path"]), str(acquisition_parameters["channel"]), Loading Loading @@ -157,6 +161,12 @@ reply = communicate(PORT,cmd_str) if (acquisition_parameters["cmode"] =="5"): path = path.replace("jpeg","jp4") circbufcmd = "echo \"3 "+str(acquisition_parameters["y_quality"])+"\" > /dev/circbuf0" subprocess.check_output(circbufcmd,stderr=subprocess.STDOUT,shell=True) communicate(PORT, "compressor_control all 0 None None None None None") communicate(PORT, "compressor_control all 3 None None None None None") timestamp =str(time.time()).replace(".","_") # later use image timestamp print("Content-Type: image/jpeg") print("Content-Disposition: inline; filename=\"elphelimg_%s.jpeg\""%(timestamp)) Loading py393/test_mcntrl.py +14 −6 Original line number Diff line number Diff line Loading @@ -428,11 +428,18 @@ USAGE if socket_conn: print(prompt , end="") sys.stdout.flush() if (args.socket_port): ready_to_read, _, _ = select.select( #ready_to_write, in_error #[socket_conn, sys.stdin], # potential_readers, [socket_conn], # potential_readers, [], # potential_writers, []) # potential_errs, else: ready_to_read, _, _ = select.select( #ready_to_write, in_error [socket_conn, sys.stdin], # potential_readers, [], # potential_writers, []) # potential_errs, if sys.stdin in ready_to_read: if (not args.socket_port) and (sys.stdin in ready_to_read): line=raw_input() # print ("stdin: ", line) elif socket_conn in ready_to_read: Loading @@ -449,6 +456,7 @@ USAGE print ("Unexpected result from select: ready_to_read = ",ready_to_read) continue else: # No sockets, just command line input if (not args.socket_port): line=raw_input(prompt) # line=raw_input('x393%s +%3.3fs--> '%(('','(simulated)')[args.simulated],(time.time()-tim))).strip() Loading Loading
py393/imgsrv.py 100644 → 100755 +10 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import time import socket import shutil import sys import subprocess path="/www/pages/img.jpeg" PORT=8888 Loading Loading @@ -95,6 +96,9 @@ if ((not acquisition_parameters["bayer"] is None) and ibayer ^= 2 acquisition_parameters["bayer"] = str(ibayer) #restart compressor communicate(PORT, "compressor_control all 1 None None None None None") cmd_str = "jpeg_acquire_write %s %s %s %s %s %s %s %s %s %s %s %s %s"%( str(acquisition_parameters["file_path"]), str(acquisition_parameters["channel"]), Loading Loading @@ -157,6 +161,12 @@ reply = communicate(PORT,cmd_str) if (acquisition_parameters["cmode"] =="5"): path = path.replace("jpeg","jp4") circbufcmd = "echo \"3 "+str(acquisition_parameters["y_quality"])+"\" > /dev/circbuf0" subprocess.check_output(circbufcmd,stderr=subprocess.STDOUT,shell=True) communicate(PORT, "compressor_control all 0 None None None None None") communicate(PORT, "compressor_control all 3 None None None None None") timestamp =str(time.time()).replace(".","_") # later use image timestamp print("Content-Type: image/jpeg") print("Content-Disposition: inline; filename=\"elphelimg_%s.jpeg\""%(timestamp)) Loading
py393/test_mcntrl.py +14 −6 Original line number Diff line number Diff line Loading @@ -428,11 +428,18 @@ USAGE if socket_conn: print(prompt , end="") sys.stdout.flush() if (args.socket_port): ready_to_read, _, _ = select.select( #ready_to_write, in_error #[socket_conn, sys.stdin], # potential_readers, [socket_conn], # potential_readers, [], # potential_writers, []) # potential_errs, else: ready_to_read, _, _ = select.select( #ready_to_write, in_error [socket_conn, sys.stdin], # potential_readers, [], # potential_writers, []) # potential_errs, if sys.stdin in ready_to_read: if (not args.socket_port) and (sys.stdin in ready_to_read): line=raw_input() # print ("stdin: ", line) elif socket_conn in ready_to_read: Loading @@ -449,6 +456,7 @@ USAGE print ("Unexpected result from select: ready_to_read = ",ready_to_read) continue else: # No sockets, just command line input if (not args.socket_port): line=raw_input(prompt) # line=raw_input('x393%s +%3.3fs--> '%(('','(simulated)')[args.simulated],(time.time()-tim))).strip() Loading