From: bfaye <bf...@ya...> - 2004-02-24 02:42:26
|
I did some "snoopying" and got some code that would get the filenames and file contents of pictures taken with the onboard camera, as well as setting the camera into the "pc sync" mode. I'm not sure how to proceed, since the code is still "immature" at best. If there is another developer that wants to take a look at the code, and add it in properly/analyze it, let me know. I will post what I got here. I added this code in the getwallpaperindices function in com_sanyo.py, and looked at the protocol log to see the filenames. I did hit a snag though, when I got to reading the 11th filename, it just hung. If I program it to skip trying to get the 11th filename, it works. I have a total 15 camera files on my phone. Heres the code: def setSanyoPCSyncMode(self): data="\xfa\x00\x0A\x00\x00\x03\x6f\x7e" request=p_sanyo.bufferpartrequest() numretry=2 self.logdata("Sanyo camera pics request: setting phone to pc sync mode", data, request) #data=com_brew.escape(data+com_brew.crcs(data))+self.pbterminator self.logdata("Sanyo phonebook request after brew escape: ", data, request) firsttwo=data[:2] try: self.comm.write(data, log=False) # we logged above data=self.comm.readuntil(self.pbterminator, logsuccess=False, numfailures=numretry) ##data=self.comm.readsome() except com_phone.modeignoreerrortypes: self.mode=self.MODENONE self.raisecommsdnaexception("manipulating the phonebook") self.comm.success=True # log it responseclass=p_sanyo.bufferpartresponse self.logdata("sanyo camera pics response: setting phone to pc sync mode", data, responseclass) data=com_brew.unescape(data) # get rid of leading junk d=data.find(firsttwo) if d>0: data=data[d:] # take off crc and terminator ::TODO:: check the crc data=data[:-3] # log it responseclass=p_sanyo.bufferpartresponse self.logdata("sanyo camera pics response: setting phone to pc sync mode", data, responseclass) return "success" def getwallpaperindices(self, results): ## added by Billy request=p_sanyo.bufferpartrequest() numretry=2 self.comm.setbaudrate(38400) self.setmode(self.MODEBREW) self.setSanyoPCSyncMode() self.comm.ser.flushInput() self.comm.ser.flushOutput() ## not sure what this does... data="\xfa\x00\x09\x71\x00\xff\xff" data=data+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" data=data+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" data=data+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" data=data+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" data=data+"\x00\x00\x00\x00\x00\x00\x01\x00\x17\xdf\x7e" self.logdata("Sanyo camera pics request", data, request) firsttwo=data[:2] try: self.comm.write(data, log=False) # we logged above data=self.comm.readuntil(self.pbterminator, logsuccess=False, numfailures=numretry) ##data=self.comm.readsome() except com_phone.modeignoreerrortypes: self.mode=self.MODENONE self.raisecommsdnaexception("manipulating the phonebook") self.comm.success=True data=com_brew.unescape(data) # log it responseclass=p_sanyo.bufferpartresponse self.logdata("sanyo camera pics response", data, responseclass) # get rid of leading junk d=data.find(firsttwo) if d>0: data=data[d:] # take off crc and terminator ::TODO:: check the crc data=data[:-3] ################## ### this probably gets a count of how many pics are in the camera folder data="\xfa\x00\x09\x72\x00\xff\xff" for stupidcount in range(0, 172): data=data+"\x00" data=data+com_brew.crcs(data)+self.pbterminator self.logdata("Sanyo camera pics request", data, request) firsttwo=data[:2] try: self.comm.write(data, log=False) # we logged above data=self.comm.readuntil(self.pbterminator, logsuccess=False, numfailures=numretry) ##data=self.comm.readsome() except com_phone.modeignoreerrortypes: self.mode=self.MODENONE self.raisecommsdnaexception("manipulating the phonebook") self.comm.success=True data=com_brew.unescape(data) # get rid of leading junk d=data.find(firsttwo) if d>0: data=data[d:] # take off crc and terminator ::TODO:: check the crc data=data[:-3] # log it responseclass=p_sanyo.bufferpartresponse self.logdata("sanyo camera pics response", data, responseclass) for d in range(0,172): data=data[1:] campiccount=ord(data[0]) self.log("got %d camera pics" % (campiccount-1,)) #################### ### read filenames for cc in range(0, campiccount): self.comm.ser.flushInput() self.comm.ser.flushOutput() data="\xfa\x00\x09\x73\x00\xff\xff" for stupidcount in range(0, 161): data=data+"\x00" if cc==11: cc=12 data=data+chr(cc) ##for c in range(0,9): ## data=data+"\x00" ##data=data+"\x7d\x5d\xb8"+self.pbterminator ##else: for c in range(0, 10): data=data+"\x00" data=data+com_brew.crcs(data)+self.pbterminator self.logdata("Sanyo camera pics request", data, request) firsttwo=data[:2] try: self.comm.write(data, log=False) # we logged above time.sleep(0.5) data=self.comm.readuntil(self.pbterminator, logsuccess=False, numfailures=numretry) ##data=self.comm.readsome() except com_phone.modeignoreerrortypes: self.mode=self.MODENONE self.raisecommsdnaexception("manipulating the phonebook") self.comm.success=True data=com_brew.unescape(data) # get rid of leading junk # log it responseclass=p_sanyo.bufferpartresponse self.logdata("sanyo camera pics response", data, responseclass) ###################### return self.getmediaindex(self.builtinimages, self.imagelocations, results, 'wallpaper-index') ------------end code I didn't have code in there that retrieves content of the files, but the command sent is fa00097400ffff followed by a bunch of zeroes (haven't counted yet), the file index number, some more zeroes, the checksum and pbterminator. Oh, my name is Billy by the way. __________________________________ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools |