LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Retrieve write protect state of USB device in user space (https://www.linuxquestions.org/questions/linux-software-2/retrieve-write-protect-state-of-usb-device-in-user-space-488939/)

GeertPh 10-03-2006 01:25 AM

Retrieve write protect state of USB device in user space
 
Hi,

I'm currently struggling with the following issue:

I have to know the write protection state of USB mass storage devices which have a mechanical switch to protect the date from being overwritten.

When I attach such USB device to our hardware (embedded software project, MIPS based. kernel 2.6.10), I see that the kernel is showing me the write protection state (on or off) of the attached device. So, the kernel can anyhow detect this.

However, I can't find a way to get this information in user space (because that's where I need it).

Does anyone know how I can get this kernel info into user space? Are there specific locations/files where I can retrieve this information, like we can use /sys/block/sda/devices to get, among other things, vendor name, version number, model,...?

So far, I didn't succeed in finding the location for the write protection state of the device.

Any help much appreciated!

Best rgds,

--Geert


All times are GMT -5. The time now is 12:28 PM.