Auto-mount USB devices?
#1
Sad 
When testing XBMC I noticed the HAL device detection in the logs, I therefor assumed that simply plugging in a USB stick or HD would be automatically mounted.

When testing, this worked because I ran XBMC in a full Ubuntu environment.

After removing the usual bootup scripts and skipping GDM and Gnome, XBMC has been working like a charm.... except drives aren't auto-mounted anymore Sad

After some investigating, it seems that I mistakenly took Gnome's built-in HAL magic for XBMC magic. Manually mounting the drive will make it show up in the source listing in non-library mode.

Does XBMC have no logic to mount USB devices on its own? If so, I still could write my own scripts to mount devices read-only so they would mount fine and still be able to just yank em out of the system when I feel like it (mounting read/write on a drive you are planning on disconnecting any time is bad practice Smile).
Reply
#2
XBMC Can mount devices its disabled by default not to mess with the os.
Start xbmc with "xbmc --standalone" and it will work.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#3
Looking into it further, I see that XBMC is issueing a 'pmount /dev/sdc1 STICKNAME' to the system. I am in the plugdev group so that shouldn't be the problem.

After looking into it further, /sys/block/sdc1/removable was '1' but calling pmount by hand gave me "Device is not removable". I even tried to use pmount-hal as I read somewhere that it ignores the sysfs data and asks HAL directly (lshal showed that indeed it detected the drive as being removable) and still it wouldn't work (it used pmount behind the scene and it did not override the removable command so ofcourse it did not work).

After finding this: https://bugs.launchpad.net/ubuntu/+sourc...bug/296164 I concluded that this is a bug in Ubuntu 8.10 Intrepid which won't be solved for a long time. Because the problem seems to be related to the default kernel or (most likely in my opinion) to pmount itself, I discovered the following workaround:

Add this to '/etc/pmount.allow':
/dev/sd[a-z]?

This will whitelist the device as being removable even if the kernel and pmount as fighting over the details. Note that this will work for other linux distributions with the same issue (make sure the removable file in /sys contains '1' and 'pmount -d /dev/sd*1' tells you it is not) while upstream figures out what to do with it.

Tip: if you are running SATA or SCSI or even SAS you will probably have one or more /dev/sd* devices already. In my case I have '/dev/sda*' and '/dev/sdb*' so I exclude those drives from pmount:
/dev/sd[c-z]?

Technical remark: normally the hard drives in you PC will not trigger a HAL event of getting added as they are simply there. However I saw that repartitioning or modifying the partition layout sometimes will trigger HAL. If you did not exclude your hard drives from the pmount whitelist, they WILL be added as removable drives - something I don't want as rebooting my HTPC is the only option to get rid of them in XBMC.
Reply
#4
Topfs2 Wrote:XBMC Can mount devices its disabled by default not to mess with the os.
Start xbmc with "xbmc --standalone" and it will work.
Forgot to mention that I am running it already with the 'standalone' flag as I removed the window manager already Nod

But as I posted a minute ago, I sort of figured out what went wrong and its not an XBMC issue (unless switching to pmount-hal and forcing the removable flag to create a workaround for the pmount/sysfs/kernel-bug in XBMC self is an option, which is not my idea of a solution).
Reply
#5
That explains why my interpid machine fails to mount with XBMC aswell. I only plugged in a USB drive once and just ssh and sudo mounted it and didnt think more of it. But then we are gonna have looots of users with this problem the following half year Smile

Anyway, the weird thing is that it seems that gnome can mount them and I though they used pmount aswell?

EDIT: Just noticed your new to the forum, Welcome to the forum!
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#6
Cheers Big Grin

I don't know why Gnome manages to mount the devices fine. They either use some custom code to detect the mount parameters from HAL or they don't use pmount at all.

I read somewhere that HAL can mount volumes as well and that gnome is using the HAL interface instead of invoking pmount under the hood; which would explain why the Intrepid bug tracker has only one mention of this instead of a ton of users complaining Smile

Edit: Yup, according to the specs you can mount directly using HAL:
http://people.freedesktop.org/~david/hal...ice-volume
Reply
#7
If thats the case then Ill try to alter the code to mount with hal instead of pmount, we use hal to recognise so we might aswell mount using it Smile

Please feel free to open a ticket on this subject and refer to this thread and Ill try to fix it when my exams are over.

Thanx for a solid bugreport!

Cheers,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#8
I've created the ticket: http://trac.xbmc.org/ticket/5491

Good luck with your examns Smile
Reply
#9
I´ve updated the code on http://xbmc.svn.sourceforge.net/viewvc/x...sion=16632

So if you could please try that on interpid that would be most wonderfull (I dont have it installed currently)

Cheers,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#10
I'm currently away from home but I'll test as soon as I get back or when I find the time to install Intrepid on a spare computer I have lying around.

Kudos for the quick fix btw, I tried hacking my own solution into XBMC and quickly drowned in all the docs between XBMC/C++/DBUS/HAL Cool
Reply
#11
cyberwizzard Wrote:I'm currently away from home but I'll test as soon as I get back or when I find the time to install Intrepid on a spare computer I have lying around.

Kudos for the quick fix btw, I tried hacking my own solution into XBMC and quickly drowned in all the docs between XBMC/C++/DBUS/HAL Cool

Hehe, no problem. When you get the time bump the ticket as fixed or not fixed and we will close or try again Smile

XBMC source is quite big, and dbus is harsh to wrap your head around first time around. personally Im just beginning to like dbus Rolleyes
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#12
I've updated the ticket and your HAL/DBUS patch worked Cool

As I've stated in the ticket, the unmount caused an error - but I yanked the stick from the port so maybe that screwed it over.

Since the GUI is rendered in Mesa using a way old machine I confiscated I didn't try unmounting properly. How do I unmount the USB drive from the GUI without a mouse? I could test properly unmounting it that way.
Reply
#13
Ill have to dig abit deeper regarding the yanking and unmounting because pmount is able to handle this, thats why the code is in place, so we clear out any added paths in /media

Actually we cant unmount media properly in gui Sad The addition to it in HalManager, and the dbus calls are simple. But I´ve hit a big snag adding it to the gui, mainly because Im not very read up on our guilib.

The plan is that it should be in before 9.04 atleast.

Thanx for testing and reporting such a good bugreport!

Merry Christmas,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#14
Ah, np Cool

This is already a big plus AFAIK which should make the next release even better on linux.

Should you need me as a tester in the future, just ask Laugh Kudos for the fix and merry christmas to you as well.
Reply
#15
I want hal mount message pop upper right corner not bottom right corner. Is it possible?
Reply

Logout Mark Read Team Forum Stats Members Help
Auto-mount USB devices?0