Re: remote-console
Ruben Miguelez Garcia <[email protected]>
| Newsgroups | gmane.comp.python.windows-ce |
|---|---|
| Message-ID | <[email protected]> |
> Ah, great. Yes, the current version only works on Windows, it requires > that the device is connected via ActiveSync. The CeRemoteAPI is used to > transfer the client script to the device, and start the interpreter there. > Sorry for this limitation. > Is there something on Linux that allows to > transfer files and start processes on the PDA? I really don't know because I didn't have time to investigate it and my application is already finished, so I won't work more with the PDA for some time. But I think It should be possible. I just connected the usb cable from the cradle to my laptop and this is the output from the kernel: -------------------- # dmesg usb 2-1: new full speed USB device using uhci_hcd and address 2 drivers/usb/serial/usb-serial.c: USB Serial support registered for Generic usbcore: registered new driver usbserial_generic usbcore: registered new driver usbserial drivers/usb/serial/usb-serial.c: USB Serial Driver core v2.0 drivers/usb/serial/usb-serial.c: USB Serial support registered for PocketPC PDA drivers/usb/serial/ipaq.c: USB PocketPC PDA driver v0.5 ipaq 2-1:1.0: PocketPC PDA converter detected usb 2-1: PocketPC PDA converter now attached to ttyUSB0 usbcore: registered new driver ipaq --------------------- For some of you, maybe this is like Chinese. But in a few words it means that my Linux (Debian 2.16) knows what I have connected and is ready to use it. The problem is that I don't know how to do it. :o) ------------------------- And about the first version of you program, which works just fine for me, I have tried to modify it slightly to send or execute programs transferring the text, but without success... Maybe because my experience with Python is not big enough. I attach here my modifications. Maybe somebody want to help. :D Ruben. _______________________________________________ PythonCE mailing list [email protected] http://mail.python.org/mailman/listinfo/pythonce
server_pc_sendfile.py
(application/x-python, 1.4 KB)
# Thomas Heller 20060109
# Start this script on the PC, then start client.py on the Pocket PC.
# Modified by Ruben Miguelez Garcia.
import socket, sys, threading
HOST = '' # Symbolic name meaning the local host
PORT = 20000 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
#------------------------
#If there a file, send and execute it
if len(sys.argv) > 1:
# Take the file
file_name=sys.argv[1]
file=open(file_name,'r')
text=file.read()
file.close()
#print text
else:
# If you don't want to send a file use the original version
print "you must provide a filename to send"
sys.exit(0)
#------------------------
#---------------------
def get_input():
#while 1:
# data = raw_input()
# conn.send(data + '\n')
#conn.send("exec("+ text +")" + "\n")
conn.send("on_pda=open(" + file_name + ",'w')\n")
conn.send("on_pda.write(" + "'''" + text + "'''" + ")\n")
conn.send("on_pda.close()\n")
conn.send('print "Program transferred"' + "\n")
sys.exit(0)
#--------------------
t = threading.Thread(target=get_input)
t.setDaemon(True)
t.start()
while 1:
data = conn.recv(1024)
if not data:
print "SystemExit, hit return to end."
raise SystemExit
sys.stderr.write(data)