TS3.03ce - USB device manager

A home for all kinds of Puppy related projects
Message
Author
2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

#16 Post by 2byte »

Thanks for the input everyone. Very informative.

Re-coding now. :)
Vern

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

Cheers Vern

#17 Post by ecomoney »

Thanks for testing everyone. Ive finally found my usb drive so I will join in on the next run. Im looking forward to your updated code.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

#18 Post by 2byte »

Sorry folks. This project for Talking Stick is dead. I've been trying to build this in puppy 3.01 and am beating my head against a wall. And unless someone can explain this to me I can only conclude that the gtk version included with 3.01 is junk. Bear with me, I'd like to explain my reasons for dumping the project.

Take a look at this function. It's called from the mount/unmount dialog when the mount button is clicked. It's a little butchered from my efforts to track down the segmentation faults, but what the heck.

Code: Select all

gboolean mount_from_tree_list(gchar* listname, gchar* retstr){
	GSList *Lnk = NULL;
	partinfo *ptinfo = NULL;
	gchar **oneline = NULL;
	gchar **output = NULL;
	char txt[25];
	char txt2[25];
	
	Lnk = ptlist;
	while(Lnk != NULL) {
		ptinfo = Lnk->data;
		if (ptinfo){
			if (strcmp((char *)ptinfo->mntpoint, "void")){
				if (!strcmp(listname, ptinfo->desc)){
g_debug("Before Mounting ptinfo->name = %s",ptinfo->name);
g_debug("Before Mounting mountflag = %d",ptinfo->mountflag);
g_debug("Before Mounting mount point = %s",ptinfo->mntpoint);
					oneline = g_strsplit ((gchar*)ptinfo->name, "/", -1);
					g_snprintf(txt,sizeof(txt), "mkdir /mnt/%s ", oneline[2]);
					g_snprintf(txt2, sizeof(txt2), "/mnt/%s ", oneline[2]);
					g_spawn_command_line_sync((gchar*)txt, (gchar **)&output,
											   NULL, NULL, NULL);
					g_free ((gchar*)output);
					g_snprintf(txt, 50, "%s %s %s %s", "mount -t", 
							  (char*)ptinfo->fmt,
							  (char*)ptinfo->name,
							  (char*)txt2);
					g_spawn_command_line_sync((gchar*)txt, (gchar **)&output,
											   NULL, NULL, NULL);
					g_free ((gchar*)output);
					ptinfo->mountflag = TRUE;
					g_stpcpy(ptinfo->mntpoint,txt2);
					g_strfreev (oneline);
					g_stpcpy(retstr,txt2);
g_debug("After Mounting ptinfo->name = %s",(gchar*)ptinfo->name);
g_debug("After Mounting mountflag = %d",ptinfo->mountflag);
g_debug("After Mounting mount point = %s",ptinfo->mntpoint);
					return TRUE;
				}
			}
		}
		Lnk = Lnk->next;
	}
	return FALSE;
}
Here is the output from compile to Ctrl-c with a couple of comments spliced in. The 'dialog is open' lines represent a global flag that is set to true and should remain true until this dialog is destroyed. FYI each 'DEBUG: dialog is open =' line represents one scan at 2 second intervals. Nothing else in the code sets it to false but notice that it gets reset after one routine is called from a timer callback. The value should have remained 1 all the way through this output. That's just one thing. Notice what happens to ptinfo->name! Where the heck does EEK// come from? On a different run it was changed to 'DR boot loader'! This is the kind of crap I'm constantly running into.

Code: Select all

# ./compile-usbmount
# ./usbmount
** (usbmount:1856): DEBUG: dialog is open = 0
** (usbmount:1856): DEBUG: ADDING ptinfo->name = /dev/sda1
- The dialog is opened here
** (usbmount:1856): DEBUG: dialog is open = 1
** (usbmount:1856): DEBUG: dialog is open = 0
** (usbmount:1856): DEBUG: dialog is open = 0
** (usbmount:1856): DEBUG: dialog is open = 0
- The mount button is clicked
** (usbmount:1856): DEBUG: Before Mounting ptinfo->name = /dev/sda1
** (usbmount:1856): DEBUG: Before Mounting mountflag = 0
** (usbmount:1856): DEBUG: Before Mounting mount point = 
mkdir: cannot create directory '/mnt/sda1': File exists
** (usbmount:1856): DEBUG: After Mounting ptinfo->name = EEK//
** (usbmount:1856): DEBUG: After Mounting mountflag = 1
** (usbmount:1856): DEBUG: After Mounting mount point = /mnt/sda1 
** (usbmount:1856): DEBUG: dialog is open = 0
- The unmount button is clicked and the device is unmounted
** (usbmount:1856): DEBUG: dialog is open = 0
- The mount button is clicked again
** (usbmount:1856): DEBUG: Before Mounting ptinfo->name = /dev/sda1
** (usbmount:1856): DEBUG: Before Mounting mountflag = 0
** (usbmount:1856): DEBUG: Before Mounting mount point = 
mkdir: cannot create directory '/mnt/sda1': File exists
** (usbmount:1856): DEBUG: After Mounting ptinfo->name = EEK//
** (usbmount:1856): DEBUG: After Mounting mountflag = 1
** (usbmount:1856): DEBUG: After Mounting mount point = /mnt/sda1 
** (usbmount:1856): DEBUG: dialog is open = 0
** (usbmount:1856): DEBUG: dialog is open = 0
- The dialog is still open at this point.
- Ctrl-c.
I think I'll continue this under puppy 2.14. Maybe it can be salvaged for the future.

Vern

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

GTK

#19 Post by ecomoney »

Hi 2byte

If the GTK version that is used in puppy 3.xx is broken, then we can fix it!!! If its causing problems for this then it is likely that it will cause problems in the future too. Let us know how you get on with it in puppy 2.14 (which has a different gtk version). You might want to look up this problem on the GTK forums too as it sounds quite specialist. Hope you can get the project started again.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
cb88
Posts: 1165
Joined: Mon 29 Jan 2007, 03:12
Location: USA
Contact:

#20 Post by cb88 »

any progress beig made here?

gtk upgrade needed? I think that is an option since even the kernel will be rebuilt...and eco seems to have alluded to upgrading gtk above

issue resolved?
Taking Puppy Linux to the limit of perfection. meanwhile try "puppy pfix=duct_tape" kernel parem eater.
X86: Sager NP6110 3630QM 16GB ram, Tyan Thunder 2 2x 300Mhz
Sun: SS2 , LX , SS5 , SS10 , SS20 ,Ultra 1, Ultra 10 , T2000
Mac: Platinum Plus, SE/30

2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

#21 Post by 2byte »

any progress beig made here?
No, been working on other things for TS3.03.

I have given it a lot of thought and I believe my mistake was using GTK for the linked list and script executions instead of using C. GTK seems to be fine for the gui. I will start from scratch and try to get it done and tested before the release date.

Pdrive is very good too, although it's still beyond the ken of ordinary win refugees. I know because my wife and daughter try this stuff out for me. You should see the look on their faces when presented with all of that drive info! What's this? What do I do now? Is it ok to ignore this and close it? :lol:

2byte

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#22 Post by ecomoney »

2 Byte,

Glad to see you have regained your enthusiasm for this project. and Im also glad that you have some people you can test your work on for this. Believe me I know exactly the "look" you are talkiing about! :D
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

Device Manager

#23 Post by ecomoney »

With the change of the project base to 2.14r, an already functioning usb device manager is already included!!! hurrah! It also picks up all of the disks and cd's.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

Post Reply