[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: help with a psp script
- From: "Brian Wallen" <bwallen@...>
- Date: Thu, 3 Apr 2008 23:25:31 -0400
I'm trying to get my PSP to connect to my telnet server and send a
command. The telnet server has no username/password, and it works from
the console on my computer. The commands it sends control my mythtv
software (open source DVR software). I can get my PSP to connect to
the server, but it won't send the command. The PSP reports that 13
bytes are sent, but what is supposed to happen doesn't really happen
(I should see a change on my screen). Any thoughts? Feel free to test
it if you have a MythTV box. Just change my IP address to yours.
BTW, I borrowed much of this code from the sample WLAN script that
comes with the PSP Lua Player, Thanks to whoever wrote it!
white = Color.new(0, 255, 0)
offscreen = Image.createEmpty(480, 272)
offscreen:clear(Color.new(0, 0, 0))
y = 0
x = 0
function graphicsPrint(text)
for i = 1, string.len(text) do
char = string.sub(text, i, i)
if char == "\n" then
y = y + 8
x = 0
elseif char ~= "\r" then
offscreen:print(x, y, char, white)
x = x + 8
end
end
screen:blit(0, 0, offscreen)
screen.waitVblankStart()
screen.flip()
end
function graphicsPrintln(text)
graphicsPrint(text .. "\n")
end
-- init WLAN and choose connection config
Wlan.init()
configs = Wlan.getConnectionConfigs()
graphicsPrintln("available connections:")
graphicsPrintln("")
for key, value in ipairs(configs) do
graphicsPrintln(key .. ": " .. value)
end
graphicsPrintln("")
graphicsPrintln("using first connection...")
Wlan.useConnectionConfig(1)
-- start connection and wait until it is connected
graphicsPrintln("waiting for WLAN init and determining IP address...")
while true do
ipAddress = Wlan.getIPAddress()
if ipAddress then break end
System.sleep(100)
end
graphicsPrintln("the PSP IP address is: " .. ipAddress)
graphicsPrintln("")
graphicsPrintln("connecting to frontend...")
socket, error = Socket.connect("192.168.1.17", 6546)
while not socket:isConnected() do System.sleep(100) end
graphicsPrintln("connected to " .. tostring(socket))
-- send request
graphicsPrintln("jumping to main menu...")
bytesSent = socket:send("jump mainmenu")
graphicsPrintln("sent " .. bytesSent .. " bytes")
Wlan.term()