Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - teddywu

Pages: [1]
1
Zaurus - pdaXrom / Xfce4 + Gthumb
« on: June 21, 2006, 11:18:43 am »
I've installed the gthumb , It's running perfectly under matchbox

But when I switch to xfce4 , I got this error "The application 'gthumb' has quit unexpectedly " below is my screen capture.

xfce4.2.2 and 4.4.4beta got a same result.


Is there anyone can run it successfully under xfce4 ?  

 [ Invalid Attachment ]

2
Zaurus - pdaXrom / Help Needed.. Usb Function
« on: June 20, 2006, 06:38:21 am »
My sl-c3000 is running 1.1.0 beta 1 w/ below partition format

/dev/hda1 ext2
/dev/hda2 fat
/dev/hda3 swap

When I using the usb function connect to windows , It only show the /hda1 partition in windows. I can't reach the hda2  

I 'm using Meanie's modified usbfunction.py
Code: [Select]
#!/usr/bin/env python
#
import gtk,os,getpass,sys
from xml.dom import minidom, Node

class usbconfig:
    DEF_PAD = 5
    FUNCTION_TYPE="net"
    STORAGE_DEVICE = "/dev/hda1"

    f = open("/proc/deviceinfo/product","r")
    MODEL = f.read()
    f.close()
    print MODEL

    if (MODEL.find("SL-C3100") != -1):
 Â    STORAGE_OPTS = ["/dev/mmcda1","/dev/hda1","/dev/hda2","/dev/hda3","/dev/hdc1","/dev/hdc2","/dev/hdc3"]
    elif (MODEL.find("SL-C3000") != -1):
 Â           HD1 = os.popen("cat /var/lib/pcmcia/stab|grep ide-cs|awk '{print $1,$5}'|grep 1|awk '{print $2}'").readline()
 Â           print HD1
 Â    if (HD1.find("hda") != -1):
 Â               print "internal hdd is hda"
 Â        STORAGE_DEVICE = "/dev/hda1"
 Â        STORAGE_OPTS = ["/dev/mmcda1","/dev/hdc1","/dev/hda1"]
 Â           else:
 Â               print "internal hdd is hdc"
 Â        STORAGE_DEVICE = "/dev/hdc1"
 Â        STORAGE_OPTS = ["/dev/mmcda1","/dev/hda1","/dev/hdc1"]

    elif os.path.exists("/dev/.devfsd"):
 Â    STORAGE_OPTS = ["/dev/mmcd/disc0/part1","/dev/hda1"]
    else:
 Â    STORAGE_OPTS = ["/dev/mmcda1","/dev/hda1"]

    if os.name == "nt":
 Â USB_TYPE_FILE = "C:\\python24\\pdaxrom\\misc\\usbd.ftype"
 Â USB_STORAGE_TYPE_FILE = "C:\\python24\\pdaxrom\\misc\\usbdstorage.conf"
 Â USB_NETWORK_CONF_FILE ="C:\\python24\\pdaxrom\\misc\\usbdnet.conf"
 Â CFG_FILENAME = ".\\usbconfig.cfg"
    else:
 Â USB_TYPE_FILE = "/etc/hotplug/usbd.ftype"
 Â USB_STORAGE_TYPE_FILE = "/etc/hotplug/usbdstorage.conf"
 Â USB_NETWORK_CONF_FILE ="/etc/hotplug/usbdnet.conf"
 Â CFG_FILENAME = os.environ['HOME'] + "/Choices/usbconfig.cfg"

    def __init__(self):
 Â if (getpass.getuser().lower() != "root"):
 Â     Warningdialog = gtk.MessageDialog(None,gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,gtk.MESSAGE_WARNING,gtk
BUTTONS_OK,"You need to be root in order to run this program.")
 Â     Warningdialog.run()
 Â     Warningdialog.destroy()
 Â     sys.exit()
 Â self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
 Â        self.window.set_title("USB function")
 Â        self.window.set_border_width(5)
 Â self.window.set_position(gtk.WIN_POS_CENTER)
 Â        self.window.set_resizable(gtk.FALSE)
 Â        self.window.connect("delete_event", gtk.main_quit)
 Â        self.window.connect("destroy", gtk.main_quit)

 Â MainBox = gtk.VBox(gtk.FALSE, self.DEF_PAD)
 Â self.window.add(MainBox)
 Â 
 Â        mainframe = gtk.Frame("USB function")
 Â MainBox.pack_start(mainframe, gtk.TRUE, gtk.TRUE, self.DEF_PAD)
 Â 
 Â vbox = gtk.VBox(gtk.FALSE, self.DEF_PAD)
 Â vbox.set_border_width(self.DEF_PAD)
 Â        mainframe.add(vbox)

    #Serial
 Â        self.serial_button = gtk.RadioButton(None, "Serial")
 Â        self.serial_button.connect("toggled", self.change_usbtype, "serial")
 Â vbox.pack_start(self.serial_button, gtk.FALSE, gtk.TRUE, 0)

    #Network
 Â        self.network_button = gtk.RadioButton(self.serial_button, "Network")
 Â        self.network_button.connect("toggled", self.change_usbtype, "net")
 Â        vbox.pack_start(self.network_button, gtk.FALSE, gtk.TRUE, self.DEF_PAD)
 Â 
 Â # IP Address  
 Â hbox = gtk.HBox(gtk.FALSE, self.DEF_PAD)
 Â vbox.pack_start(hbox, gtk.FALSE, gtk.TRUE, 0)
 Â     
 Â        self.network_ip = gtk.Entry(0)
 Â        self.network_ip.set_text("192.168.129.201")
 Â        self.network_ip.set_size_request(160,30)
 Â hbox.pack_end(self.network_ip, gtk.FALSE, gtk.TRUE, 0)

 Â        label = gtk.Label("IP:")
 Â        hbox.pack_end(label, gtk.FALSE, gtk.TRUE, 0)


 Â # IP Netmask
 Â hbox = gtk.HBox(gtk.FALSE, self.DEF_PAD)
 Â vbox.pack_start(hbox, gtk.FALSE, gtk.TRUE, 0)
 Â     
 Â        self.network_netmask = gtk.Entry(0)
 Â        self.network_netmask.set_text("255.255.255.0")
 Â        self.network_netmask.set_size_request(160,30)
 Â hbox.pack_end(self.network_netmask, gtk.FALSE, gtk.TRUE, 0)

 Â        label = gtk.Label("Netmask:")
 Â        hbox.pack_end(label, gtk.FALSE, gtk.TRUE, 0)

 Â # IP gateway
 Â hbox = gtk.HBox(gtk.FALSE, self.DEF_PAD)
 Â vbox.pack_start(hbox, gtk.FALSE, gtk.TRUE, 0)
 Â     
 Â        self.network_gw = gtk.Entry(0)
 Â        self.network_gw.set_size_request(160,30)
 Â hbox.pack_end(self.network_gw, gtk.FALSE, gtk.TRUE, 0)

 Â        label = gtk.Label("Gateway:")
 Â        hbox.pack_end(label, gtk.FALSE, gtk.TRUE, 0)

 Â # IP DNS
 Â hbox = gtk.HBox(gtk.FALSE, self.DEF_PAD)
 Â vbox.pack_start(hbox, gtk.FALSE, gtk.TRUE, 0)
 Â     
 Â        self.network_dns = gtk.Entry(0)
 Â        self.network_dns.set_size_request(160,30)
 Â hbox.pack_end(self.network_dns, gtk.FALSE, gtk.TRUE, 0)

 Â        label = gtk.Label("DNS:")
 Â        hbox.pack_end(label, gtk.FALSE, gtk.TRUE, 0)
    #Storage

 Â hbox = gtk.HBox(gtk.FALSE, self.DEF_PAD)
 Â vbox.pack_start(hbox, gtk.FALSE, gtk.TRUE, self.DEF_PAD)

 Â        self.storage_button = gtk.RadioButton(self.serial_button, "Storage")
 Â        self.storage_button.connect("toggled", self.change_usbtype, "storage")
 Â hbox.pack_start(self.storage_button, gtk.FALSE, gtk.TRUE, 0)
 Â 
 Â self.storage_type_menu = gtk.combo_box_new_text()
 Â           self.storage_type_menu.append_text("Secure Digital (SD)")
 Â if (self.MODEL.find("SL-C3100") != -1):
 Â     self.storage_type_menu.append_text("Compact Flash (CF 0,1)")
 Â     self.storage_type_menu.append_text("Compact Flash (CF 0,2)")
 Â     self.storage_type_menu.append_text("Compact Flash (CF)0,3")
 Â     self.storage_type_menu.append_text("Compact Flash (CF)1,1")
 Â     self.storage_type_menu.append_text("Compact Flash (CF)1,2")
 Â     self.storage_type_menu.append_text("Compact Flash (CF)1,3")
 Â elif (self.MODEL.find("SL-C3000") != -1):
 Â            self.storage_type_menu.append_text("Compact Flash (CF)")
 Â            self.storage_type_menu.append_text("Internal Storage")
 Â else:
 Â            self.storage_type_menu.append_text("Compact Flash (CF)")
 Â        self.storage_type_menu.connect('changed', self.change_storage_type)
 Â self.storage_type_menu.set_size_request(180,30)

 Â hbox.pack_end(self.storage_type_menu, gtk.FALSE, gtk.TRUE, self.DEF_PAD)

 Â        bbox = gtk.HButtonBox ()
 Â        MainBox.pack_start(bbox, gtk.FALSE, gtk.FALSE, 0)
 Â        bbox.set_layout(gtk.BUTTONBOX_END)

 Â        cancel_button = gtk.Button("Cancel",gtk.STOCK_CANCEL)
 Â        cancel_button.connect("clicked", gtk.main_quit)
 Â        bbox.add(cancel_button)

 Â        okbutton = gtk.Button("Ok",gtk.STOCK_OK)
 Â        okbutton.connect("clicked", self.close_and_update)
 Â        bbox.add(okbutton)
 Â        okbutton.set_flags(gtk.CAN_DEFAULT)
 Â        okbutton.grab_default()

 Â self.load_prefs();

 Â if self.FUNCTION_TYPE == "net":
 Â     self.network_button.set_active(gtk.TRUE)
 Â elif self.FUNCTION_TYPE == "storage":
 Â     self.storage_button.set_active(gtk.TRUE)
 Â elif self.FUNCTION_TYPE == "serial":
 Â     self.change_usbtype(None,"serial")
 Â     self.serial_button.set_active(gtk.TRUE)
 Â 
 Â self.find_storage(self.STORAGE_DEVICE)
 Â 
 Â #if (self.STORAGE_DEVICE == "/dev/mmcda1"):
 Â #    self.storage_type_menu.set_active(0)
 Â #else:
 Â #    self.storage_type_menu.set_active(1)
 Â 
 Â self.window.show_all()

    def find_storage(self, data=None):
 Â n = 0
 Â for dev in self.STORAGE_OPTS:
 Â     if (dev == data):
 Â     self.storage_type_menu.set_active(n)
 Â     return True
 Â     else:
 Â     n = n + 1
 Â self.storage_type_menu.set_active(0)
 Â return False

    def change_usbtype(self, widget, data=None):
 Â if (data == "net"):
 Â     self.storage_type_menu.set_sensitive(gtk.FALSE)
 Â     self.network_ip.set_sensitive(gtk.TRUE)
 Â     self.network_netmask.set_sensitive(gtk.TRUE)
 Â     self.network_gw.set_sensitive(gtk.TRUE)
 Â     self.network_dns.set_sensitive(gtk.TRUE)
 Â     self.FUNCTION_TYPE = data
 Â elif(data == "storage"):
 Â     self.storage_type_menu.set_sensitive(gtk.TRUE)
 Â     self.network_ip.set_sensitive(gtk.FALSE)
 Â     self.network_netmask.set_sensitive(gtk.FALSE)
 Â     self.network_gw.set_sensitive(gtk.FALSE)
 Â     self.network_dns.set_sensitive(gtk.FALSE)
 Â     self.FUNCTION_TYPE = data
 Â elif(data == "serial"):
 Â     self.network_ip.set_sensitive(gtk.FALSE)
 Â     self.network_netmask.set_sensitive(gtk.FALSE)
 Â     self.network_gw.set_sensitive(gtk.FALSE)
 Â     self.network_dns.set_sensitive(gtk.FALSE)
 Â     self.storage_type_menu.set_sensitive(gtk.FALSE)
 Â     self.FUNCTION_TYPE = data
 Â return True

    def change_storage_type(self, combobox):
 Â self.STORAGE_DEVICE = self.STORAGE_OPTS[combobox.get_active()]
 Â return True

    def close_and_update(self,widget):
 Â if (self.FUNCTION_TYPE == "net"):
 Â     f=open(self.USB_NETWORK_CONF_FILE, "w")
 Â     writestr = ""
 Â     writestr = writestr + "IP=" + self.network_ip.get_text() + "\n"
 Â     writestr = writestr + "NETMASK=" + self.network_netmask.get_text() + "\n";
 Â     writestr = writestr + "GATEWAY=" + self.network_gw.get_text() + "\n";
 Â     writestr = writestr + "DNS=" + self.network_dns.get_text() + "\n";
 Â     writestr = writestr + "DHCPS=yes\n";
 Â     writestr = writestr + "DHCPC=no\n";
 Â     f.write(writestr)
 Â     f.close()
 Â     os.system("rm -f /etc/hotplug/usbdstorage.conf");
 Â elif (self.FUNCTION_TYPE == "storage"):
 Â     f=open(self.USB_STORAGE_TYPE_FILE, "w")
 Â     f.write(self.STORAGE_DEVICE+ "\n")
 Â     f.close()
 Â f=open(self.USB_TYPE_FILE, "w")
 Â f.write(self.FUNCTION_TYPE + "\n")
 Â f.close()
 Â 
 Â self.save_prefs()
 Â os.system("/etc/usbcontrol " + self.FUNCTION_TYPE)
 Â gtk.main_quit()

    def load_prefs(self):
 Â if os.path.isfile(self.CFG_FILENAME):
 Â     try:
 Â   xmldoc = minidom.parse(self.CFG_FILENAME)
 Â     except:
 Â   return False
 Â     else:
 Â   tags = xmldoc.getElementsByTagName("USBCONFIGSETTINGS");
 Â   for tag in tags:      
 Â       usbtypes = tag.getElementsByTagName("TYPE")
 Â       for usbtype in usbtypes:
 Â     self.FUNCTION_TYPE = usbtype.getAttribute("type")
 Â     
 Â       usbnetworks = tag.getElementsByTagName("USBNETWORK")
 Â       for usbnetwork in usbnetworks:
 Â     self.network_ip.set_text(usbnetwork.getAttribute("ip"))
 Â     self.network_netmask.set_text(usbnetwork.getAttribute("netmask"))
 Â     self.network_gw.set_text(usbnetwork.getAttribute("gateway"))
 Â     self.network_dns.set_text(usbnetwork.getAttribute("dns"))
 Â       
 Â       usbstorages = tag.getElementsByTagName("USBSTORAGE")
 Â       for usbstorage in usbstorages:
 Â     self.STORAGE_DEVICE = usbstorage.getAttribute("USBSTORAGEDEVICE")
 Â   return True
 Â else:
 Â     return False

    def save_prefs(self,widget=None):
 Â conf_tree = minidom.Document()
 Â conf_tree.appendChild(conf_tree.createComment("pdaXrom settings file"))
 Â root_node = conf_tree.createElement("USBCONFIGSETTINGS")

 Â node = conf_tree.createElement("TYPE")
 Â node.setAttribute("type", self.FUNCTION_TYPE)
 Â root_node.appendChild(node)

 Â node = conf_tree.createElement("USBNETWORK")
 Â node.setAttribute("ip", self.network_ip.get_text())
 Â node.setAttribute("netmask", self.network_netmask.get_text())
 Â node.setAttribute("gateway", self.network_gw.get_text())
 Â node.setAttribute("dns", self.network_dns.get_text())
 Â root_node.appendChild(node)

 Â node = conf_tree.createElement("USBSTORAGE")
 Â node.setAttribute("USBSTORAGEDEVICE", self.STORAGE_DEVICE)
 Â root_node.appendChild(node)

 Â conf_tree.appendChild(root_node)
 Â FD = open(self.CFG_FILENAME, "w")
 Â FD.write(conf_tree.toprettyxml())
 Â FD.close()

    def main(self):
 Â gtk.main()

if __name__ == "__main__":
    usbconfig = usbconfig()
    usbconfig.main()

where should I change or not here....?

Thanks a lot..

Pages: [1]