OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: Jon_J on January 27, 2007, 10:13:35 am

Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Jon_J on January 27, 2007, 10:13:35 am
On my C3200, I installed pdaxrom beta 3, then installed pdaxii13.
I used the suggested partitioning and I also installed the full image.
I cannot seem to get USB storage mode to recognise my internal FAT formatted partition.
When I hook up my Z to my windows box, SD and CF are the only mounts available. I need to copy stuff to my FAT formatted hard drive.
Below is some info of my mounts, etc.
Code: [Select]
mount
rootfs on / type rootfs (rw)
/dev/root on /media/realroot type jffs2 (rw)
/dev/hda1 on / type ext3 (rw)
/proc on /proc type proc (rw)
none on /dev type tmpfs (rw)
/dev/hda3 on /data type vfat (rw,noatime,nosuid,nodev)
none on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
/dev/mmcda1 on /mnt/card type vfat (rw,noatime)

df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/hda1                 2.0G    467.4M      1.5G  24% /
/dev/hda1                 2.0G    467.4M      1.5G  24% /
none                     12.0M     24.0k     12.0M   0% /dev
/dev/hda3                 3.4G      2.0M      3.4G   0% /data
none                     12.0M     24.0k     12.0M   0% /dev
/dev/mmcda1               1.9G    132.3M      1.8G   7% /mnt/card

sfdisk -ls
Disk /dev/hda: 11905 cylinders, 16 heads, 63 sectors/track
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/hda1          0+   4263    4264-   2149055+  83  Linux
/dev/hda2       4264    4760     497     250488   82  Linux swap
/dev/hda3       4761   11904    7144    3600576    c  Win95 FAT32 (LBA)
/dev/hda4          0       -       0          0    0  Empty
total: 7985302 blocks
Here's a screenshot of the USB settings, showing the absence of "Internal Storage"

Thanks to any pdaxii13 users for some help on this.
Jon
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: InSearchOf on January 27, 2007, 11:17:30 am
that app was built prior to the internal storage days... you will have to edit the  usbfunction.py (I think that is what it is) file and implement selections for internal storage...

Thanks for the reminder though... I have to add it to the list of things to do before next release...

Late
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Jon_J on January 27, 2007, 11:30:09 am
meanie has it working. If you look at his page on pdaxii13, there is some discussion of USB storage and the "Internal Storage" option. Here's a screenshot of USB settings from that page.
I'll try to locate usbfunction.py and edit it and see if I can get it to work.
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Jon_J on January 29, 2007, 11:29:07 am
Quote
that app was built prior to the internal storage days... you will have to edit the  usbfunction.py (I think that is what it is) file and implement selections for internal storage...

Thanks for the reminder though... I have to add it to the list of things to do before next release...

Late
[div align=\"right\"][a href=\"index.php?act=findpost&pid=152648\"][{POST_SNAPBACK}][/a][/div]
I'm not a programmer, and I have no knowledge of python programming.
Can anyone tell me where and what to modify in my "usbfunction.py" in order to get "Internal storage" included in the selection in the USB settings app?
Thank you
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/hda3"

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

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

    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()
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Meanie on January 31, 2007, 08:10:23 pm
That's a bug in my updated python script. There is a line which checks for C3000 which should be checking for all C3x00 models instead.
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Meanie on January 31, 2007, 08:11:29 pm
Quote
That's a bug in my updated python script. There is a line which checks for C3000 which should be checking for all C3x00 models instead.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153107\"][{POST_SNAPBACK}][/a][/div]


I will upload the updated package and also updated initrd.bin for akita when I get home (which is sometime in the near future i hope)
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Jon_J on January 31, 2007, 09:37:47 pm
I got USB storage mode working on my C3200 under both the akita and original pdaxii13 versions.
In usbfunction.py I changed line 131 from
if (self.MODEL.find("SL-C3100") != -1):
to
if (self.MODEL.find("SL-C3200") != -1):

Now I have 6 Compact Flash selections in USB settings, just like the C3100 users do.
I just selected "Compact flash (CF 0,2)
That is the setting that allows me to access my FAT hdc3 partition from Windows.
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: InSearchOf on January 31, 2007, 09:47:39 pm
I forgot post...

but as stated above in the script... all you have to do is pipe in the 3 models like above in your script

so replacing what you put with
Code: [Select]
if (self.MODEL.find("SL-C3000") != -1) | (self.MODEL.find("SL-C3100") != -1) | (self.MODEL.find("SL-C3200") != -1):Will fix it for all models...

I will change it in the next build

Late
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Meanie on January 31, 2007, 10:14:52 pm
Quote
I forgot post...

but as stated above in the script... all you have to do is pipe in the 3 models like above in your script

so replacing what you put with
Code: [Select]
if (self.MODEL.find("SL-C3000") != -1) | (self.MODEL.find("SL-C3100") != -1) | (self.MODEL.find("SL-C3200") != -1):Will fix it for all models...

I will change it in the next build

Late
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153121\"][{POST_SNAPBACK}][/a][/div]

that's what my updated script does. it also removes all the other options for you to guess and select a partition, it is only shows "Internal Storage" as a single option which is the third partition (and it also figures out for you whether it is /dev/hda3 or /dev/hdc3)
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: daniel3000 on February 01, 2007, 04:12:43 am
Quote
Quote
I forgot post...

but as stated above in the script... all you have to do is pipe in the 3 models like above in your script

so replacing what you put with
Code: [Select]
if (self.MODEL.find("SL-C3000") != -1) | (self.MODEL.find("SL-C3100") != -1) | (self.MODEL.find("SL-C3200") != -1):Will fix it for all models...

I will change it in the next build

Late
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153121\"][{POST_SNAPBACK}][/a][/div]

that's what my updated script does. it also removes all the other options for you to guess and select a partition, it is only shows "Internal Storage" as a single option which is the third partition (and it also figures out for you whether it is /dev/hda3 or /dev/hdc3)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153126\"][{POST_SNAPBACK}][/a][/div]


Great! That automatic /hda / /hdc setting was one of the things on my own todo list. Thanks!
Where can we find that updated script exactly?

daniel
Title: Pdaxii13 Usb Storage, Where Is "internal Storage"
Post by: Meanie on February 01, 2007, 08:32:40 am
Quote
Quote
Quote
I forgot post...

but as stated above in the script... all you have to do is pipe in the 3 models like above in your script

so replacing what you put with
Code: [Select]
if (self.MODEL.find("SL-C3000") != -1) | (self.MODEL.find("SL-C3100") != -1) | (self.MODEL.find("SL-C3200") != -1):Will fix it for all models...

I will change it in the next build

Late
[div align=\"right\"][{POST_SNAPBACK}][/a][/div] (http://index.php?act=findpost&pid=153121\")

that's what my updated script does. it also removes all the other options for you to guess and select a partition, it is only shows "Internal Storage" as a single option which is the third partition (and it also figures out for you whether it is /dev/hda3 or /dev/hdc3)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153126\"][{POST_SNAPBACK}][/a][/div]


Great! That automatic /hda / /hdc setting was one of the things on my own todo list. Thanks!
Where can we find that updated script exactly?

daniel
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153176\"][{POST_SNAPBACK}][/a][/div]

it's inside this updated package
[a href=\"http://www.tyrannozaurus.com/feed/beta3/custom/usbdconfig_1.1.1-3_armv5tel.ipk]http://www.tyrannozaurus.com/feed/beta3/cu...-3_armv5tel.ipk[/url]