Comments (29)
Hi @benjaminesse,
sorry for the long delay.
What happens when you run your python code as root with a spectrometer attached?
-Andreas
from python-seabreeze.
Hi,
That works fine, it finds the spectrometer with no problems. Is there a way around running it from root every time? I'm not too familiar with Linux, I have used it sporadically but most of my development has been in windows, so apologies if I'm missing something!
Cheers,
Ben
from python-seabreeze.
See if your user is in the "plugdev" group:
see which groups your linux user belongs to
And create the "plugdev" group and add your user to it if necessary:
add a user to a group
-Andreas
from python-seabreeze.
Hey wait...i have the exact same problem ....i did not understand how benjamin solved his problem ...please help me solve it ...... and AP ....when i write groups in my pi user name it returns plugdev
from python-seabreeze.
your udev rules are installed correctly if there is a new symlink created in /dev
after you plug in your spectrometer. This symlink (if you have a USB2000 spectrometer, for example: /dev/usb2000-12345
, where 12345 is some number or string) should be owned by the plugdev group.
from python-seabreeze.
Hi,
I reloaded the udev rules fine with the update you referenced above, but I still can't connect without running the code from root.
I checked /dev and couldn't find a symlink (I'm running a Flame so I'm assuming it will be of the form "FLM-12345")
Thanks again
from python-seabreeze.
I think the flame should show up as a usb2000plus-
what's the output of lsusb when spectrometer is connected?
from python-seabreeze.
There is no USB symlink either. The output of lssub is:
Bus 001 Device 006: ID 2457:101e
Bus 001 Device 005: ID 03f0:034a Hewlett-Packard
Bus 001 Device 004: ID 0461:4d22 Primax Electronics, Ltd
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
from python-seabreeze.
so the udev rule for the USB2000plus will match. (The flame acts like a USB2000+ on the driver side)
ATTR{idVendor}=="2457", ATTR{idProduct}=="101e", SYMLINK+="usb2000+-%n", GROUP="plugdev"
when your spectrometer is plugged in what does the following command return:
ls /dev/usb*
from python-seabreeze.
It returns
ls: cannot access /dev/usb*: No such file or directory
from python-seabreeze.
and
ls /etc/udev/rules.d/
from python-seabreeze.
10-oceanoptics.rules 99-com.rules
from python-seabreeze.
Hmm,
this is most likely due to your udev version.
Try using an older version of the rules from here
download the file linked to above and overwrite the file /etc/udev/rules.d/10-oceanoptics.rules
on your rpi.
make sure that when you type cat /etc/udev/rules.d/10-oceanoptics.rules
it says ATTRS everywhere and not ATTR (as it does in the newer version of that file)
after that reboot your rpi.
If this doesn't help, I can't really provide further help.
It's best if you google how to debug udev rules and try to figure out why the provided rules don't match. It's not complicated to do that. You'll find a tutorial easily. Good luck!
from python-seabreeze.
Nope, still got the same problem. I'll look into the udev rules then, thanks for your help!
from python-seabreeze.
Np.
one more quick thing to try:
use the newer file again (the one with ATTR)
and delete line 4, the one that starts with SUBSYSTEM...
save it.
reboot.
If that didn't help, and you figure out what's wrong, it would be great if you could report back!
Good luck!
from python-seabreeze.
when i try to run sudo python ......i cannot import this "import seabreeze.spectrometers as sb" .....says no such module
from python-seabreeze.
@soumendras https://stackoverflow.com/questions/25346171/cant-import-module-when-using-root-user
from python-seabreeze.
@benjaminesse
run lsusb
it returns something like:
Bus 001 Device 006: ID 2457:101e
Bus 001 Device 005: ID 03f0:034a Hewlett-Packard
Bus 001 Device 004: ID 0461:4d22 Primax Electronics, Ltd
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
2457:101e
is your spectrometer. Remember Bus 001 and Device 006. and use these numbers in the following command:
udevadm info --attribute-walk --name=/dev/bus/usb/001/006
post the output here.
from python-seabreeze.
in my case the above command returns this
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5':
KERNEL=="1-1.5"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{bDeviceClass}=="00"
ATTR{manufacturer}=="USB4000 3.00.03"
ATTR{bmAttributes}=="80"
ATTR{bConfigurationValue}=="1"
ATTR{version}==" 2.00"
ATTR{devnum}=="6"
ATTR{bMaxPower}=="400mA"
ATTR{idProduct}=="1022"
ATTR{avoid_reset_quirk}=="0"
ATTR{urbnum}=="9"
ATTR{bDeviceSubClass}=="00"
ATTR{maxchild}=="0"
ATTR{bcdDevice}=="0002"
ATTR{bMaxPacketSize0}=="64"
ATTR{idVendor}=="2457"
ATTR{product}=="Ocean Optics USB4000"
ATTR{speed}=="480"
ATTR{removable}=="removable"
ATTR{ltm_capable}=="no"
ATTR{bNumConfigurations}=="1"
ATTR{busnum}=="1"
ATTR{authorized}=="1"
ATTR{quirks}=="0x0"
ATTR{configuration}==""
ATTR{devpath}=="1.5"
ATTR{bDeviceProtocol}=="00"
ATTR{bNumInterfaces}==" 1"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceClass}=="09"
ATTRS{bmAttributes}=="e0"
ATTRS{bConfigurationValue}=="1"
ATTRS{version}==" 2.00"
ATTRS{devnum}=="2"
ATTRS{bMaxPower}=="2mA"
ATTRS{idProduct}=="9514"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{urbnum}=="69"
ATTRS{bDeviceSubClass}=="00"
ATTRS{maxchild}=="5"
ATTRS{bcdDevice}=="0200"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{idVendor}=="0424"
ATTRS{speed}=="480"
ATTRS{removable}=="unknown"
ATTRS{ltm_capable}=="no"
ATTRS{bNumConfigurations}=="1"
ATTRS{busnum}=="1"
ATTRS{authorized}=="1"
ATTRS{quirks}=="0x0"
ATTRS{configuration}==""
ATTRS{devpath}=="1"
ATTRS{bDeviceProtocol}=="02"
ATTRS{bNumInterfaces}==" 1"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceClass}=="09"
ATTRS{manufacturer}=="Linux 4.9.35-v7+ dwc_otg_hcd"
ATTRS{bmAttributes}=="e0"
ATTRS{bConfigurationValue}=="1"
ATTRS{version}==" 2.00"
ATTRS{devnum}=="1"
ATTRS{bMaxPower}=="0mA"
ATTRS{idProduct}=="0002"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{urbnum}=="25"
ATTRS{bDeviceSubClass}=="00"
ATTRS{maxchild}=="1"
ATTRS{bcdDevice}=="0409"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{idVendor}=="1d6b"
ATTRS{product}=="DWC OTG Controller"
ATTRS{speed}=="480"
ATTRS{authorized_default}=="1"
ATTRS{interface_authorized_default}=="1"
ATTRS{removable}=="unknown"
ATTRS{ltm_capable}=="no"
ATTRS{serial}=="3f980000.usb"
ATTRS{bNumConfigurations}=="1"
ATTRS{busnum}=="1"
ATTRS{authorized}=="1"
ATTRS{quirks}=="0x0"
ATTRS{configuration}==""
ATTRS{devpath}=="0"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bNumInterfaces}==" 1"
looking at parent device '/devices/platform/soc/3f980000.usb':
KERNELS=="3f980000.usb"
SUBSYSTEMS=="platform"
DRIVERS=="dwc_otg"
ATTRS{wr_reg_test}=="Time to write GNPTXFSIZ reg 10000000 times: 730 msecs ( 73 jiffies)"
ATTRS{grxfsiz}=="GRXFSIZ = 0x00000306"
ATTRS{srpcapable}=="SRPCapable = 0x1"
ATTRS{buspower}=="Bus Power = 0x1"
ATTRS{bussuspend}=="Bus Suspend = 0x0"
ATTRS{hptxfsiz}=="HPTXFSIZ = 0x02000406"
ATTRS{hnp}=="HstNegScs = 0x0"
ATTRS{mode}=="Mode = 0x1"
ATTRS{mode_ch_tim_en}=="Mode Change Ready Timer Enable = 0x0"
ATTRS{hsic_connect}=="HSIC Connect = 0x1"
ATTRS{gsnpsid}=="GSNPSID = 0x4f54280a"
ATTRS{driver_override}=="(null)"
ATTRS{hcd_frrem}=="HCD Dump Frame Remaining"
ATTRS{gotgctl}=="GOTGCTL = 0x001c0001"
ATTRS{gpvndctl}=="GPVNDCTL = 0x00000000"
ATTRS{hnpcapable}=="HNPCapable = 0x1"
ATTRS{spramdump}=="SPRAM Dump"
ATTRS{regoffset}=="0xffffffff"
ATTRS{gnptxfsiz}=="GNPTXFSIZ = 0x01000306"
ATTRS{guid}=="GUID = 0x2708a000"
ATTRS{regdump}=="Register Dump"
ATTRS{hprt0}=="HPRT0 = 0x00001005"
ATTRS{hcddump}=="HCD Dump"
ATTRS{rem_wakeup_pwrdn}==""
ATTRS{regvalue}=="invalid offset"
ATTRS{gusbcfg}=="GUSBCFG = 0x20001700"
ATTRS{fr_interval}=="Frame Interval = 0x1d4b"
ATTRS{busconnected}=="Bus Connected = 0x1"
ATTRS{remote_wakeup}=="Remote Wakeup Sig = 0 Enabled = 0 LPM Remote Wakeup = 0"
ATTRS{devspeed}=="Device Speed = 0x0"
ATTRS{rd_reg_test}=="Time to read GNPTXFSIZ reg 10000000 times: 1410 msecs ( 141 jiffies)"
ATTRS{enumspeed}=="Device Enumeration Speed = 0x1"
ATTRS{inv_sel_hsic}=="Invert Select HSIC = 0x0"
ATTRS{ggpio}=="GGPIO = 0x00000000"
ATTRS{srp}=="SesReqScs = 0x1"
looking at parent device '/devices/platform/soc':
KERNELS=="soc"
SUBSYSTEMS=="platform"
DRIVERS==""
ATTRS{driver_override}=="(null)"
looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""
from python-seabreeze.
@benjaminesse any update on how did you run python as sudo and still call those dependencies?
from python-seabreeze.
Hi @soumendras, from that tutorial (and anyone correct me if I am wrong) when you run python from root the normal version associated that is used when you use the command
python hello.py
is not necessarily the same, so any libraries you have installed (such as the python-seabreeze) aren't installed in that version. I got around this by putting
#!PATHTOPYTHON
as the first line in the program replacing the PATHTOPYTHON with the actual path eg
#!/home/pi/berryconda3/bin/python3.6
for me. You then run it from root by typing
sudo ./hello.py
in the command line.
@ap-- I tried your suggestion of removing the lines and it worked, I now have no issues getting the program to detect the spectrometer, thank you! The output of the command you posted 2 comments back is:
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5':
KERNEL=="1-1.5"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{bDeviceSubClass}=="00"
ATTR{bDeviceProtocol}=="00"
ATTR{devpath}=="1.5"
ATTR{idVendor}=="2457"
ATTR{speed}=="480"
ATTR{bNumInterfaces}==" 1"
ATTR{bConfigurationValue}=="1"
ATTR{bMaxPacketSize0}=="64"
ATTR{busnum}=="1"
ATTR{devnum}=="7"
ATTR{configuration}==""
ATTR{bMaxPower}=="400mA"
ATTR{authorized}=="1"
ATTR{bmAttributes}=="80"
ATTR{bNumConfigurations}=="1"
ATTR{maxchild}=="0"
ATTR{bcdDevice}=="0002"
ATTR{avoid_reset_quirk}=="0"
ATTR{quirks}=="0x0"
ATTR{version}==" 2.00"
ATTR{urbnum}=="64"
ATTR{ltm_capable}=="no"
ATTR{manufacturer}=="Flame-S 4.01.0 "
ATTR{removable}=="removable"
ATTR{idProduct}=="101e"
ATTR{bDeviceClass}=="00"
ATTR{product}=="Ocean Optics Flame-S"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="02"
ATTRS{devpath}=="1"
ATTRS{idVendor}=="0424"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{busnum}=="1"
ATTRS{devnum}=="2"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="2mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="5"
ATTRS{bcdDevice}=="0200"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="112"
ATTRS{ltm_capable}=="no"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="9514"
ATTRS{bDeviceClass}=="09"
looking at parent device '/devices/platform/soc/3f980000.usb/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="01"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
ATTRS{speed}=="480"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{authorized_default}=="1"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="0mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="1"
ATTRS{interface_authorized_default}=="1"
ATTRS{bcdDevice}=="0404"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{quirks}=="0x0"
ATTRS{serial}=="3f980000.usb"
ATTRS{version}==" 2.00"
ATTRS{urbnum}=="25"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 4.4.34-v7+ dwc_otg_hcd"
ATTRS{removable}=="unknown"
ATTRS{idProduct}=="0002"
ATTRS{bDeviceClass}=="09"
ATTRS{product}=="DWC OTG Controller"
looking at parent device '/devices/platform/soc/3f980000.usb':
KERNELS=="3f980000.usb"
SUBSYSTEMS=="platform"
DRIVERS=="dwc_otg"
ATTRS{hnp}=="HstNegScs = 0x0"
ATTRS{srp}=="SesReqScs = 0x1"
ATTRS{regvalue}=="invalid offset"
ATTRS{hsic_connect}=="HSIC Connect = 0x1"
ATTRS{guid}=="GUID = 0x2708a000"
ATTRS{mode}=="Mode = 0x1"
ATTRS{srpcapable}=="SRPCapable = 0x1"
ATTRS{regdump}=="Register Dump"
ATTRS{gpvndctl}=="GPVNDCTL = 0x00000000"
ATTRS{ggpio}=="GGPIO = 0x00000000"
ATTRS{hprt0}=="HPRT0 = 0x00001005"
ATTRS{wr_reg_test}=="Time to write GNPTXFSIZ reg 10000000 times: 370 msecs (37 jiffies)"
ATTRS{driver_override}=="(null)"
ATTRS{hcd_frrem}=="HCD Dump Frame Remaining"
ATTRS{mode_ch_tim_en}=="Mode Change Ready Timer Enable = 0x0"
ATTRS{gnptxfsiz}=="GNPTXFSIZ = 0x01000306"
ATTRS{remote_wakeup}=="Remote Wakeup Sig = 0 Enabled = 0 LPM Remote Wakeup = 0"
ATTRS{busconnected}=="Bus Connected = 0x1"
ATTRS{hcddump}=="HCD Dump"
ATTRS{gotgctl}=="GOTGCTL = 0x001c0001"
ATTRS{spramdump}=="SPRAM Dump"
ATTRS{grxfsiz}=="GRXFSIZ = 0x00000306"
ATTRS{gsnpsid}=="GSNPSID = 0x4f54280a"
ATTRS{gusbcfg}=="GUSBCFG = 0x20001700"
ATTRS{hptxfsiz}=="HPTXFSIZ = 0x02000406"
ATTRS{devspeed}=="Device Speed = 0x0"
ATTRS{fr_interval}=="Frame Interval = 0x1d4c"
ATTRS{rem_wakeup_pwrdn}==""
ATTRS{bussuspend}=="Bus Suspend = 0x0"
ATTRS{buspower}=="Bus Power = 0x1"
ATTRS{hnpcapable}=="HNPCapable = 0x1"
ATTRS{rd_reg_test}=="Time to read GNPTXFSIZ reg 10000000 times: 940 msecs (94 jiffies)"
ATTRS{enumspeed}=="Device Enumeration Speed = 0x1"
ATTRS{inv_sel_hsic}=="Invert Select HSIC = 0x0"
ATTRS{regoffset}=="0xffffffff"
looking at parent device '/devices/platform/soc':
KERNELS=="soc"
SUBSYSTEMS=="platform"
DRIVERS==""
ATTRS{driver_override}=="(null)"
looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""
from python-seabreeze.
@benjaminesse
awesome! I'll fix this at some point in the future, until then we'll leave this open for people who run into the udev issue.
Note to self: udev SUBSYSTEM needs to match against "usb" not "usb_device" on raspbian jessie ?!?
WORKAROUND
if you're on raspbian and you have this issue open the 10-oceanoptics.rules file and replace "usb_device" with "usb" in line 4.
from python-seabreeze.
I had the same problem as this, but my rpi3 does not even recognize the spectrometer when connected, in the lsusb command it is also not listed. I followed all these steps and the tutorial and nothing has changed, what do I do? The model of the spectrometer is the USB2000 +
from python-seabreeze.
from python-seabreeze.
Yes, I did it, it's like this: SUBSYSTEM!="usb", ACTION!="add", GOTO="oceanoptics_rules_end". Is that correct?
from python-seabreeze.
from python-seabreeze.
I searched the document, but there was no other line containing "usb_device"
from python-seabreeze.
from python-seabreeze.
I'm not sure what version of python I've installed berryconda, but I'll install it all again to make sure. Apparently the pyseabreeze is installed correctly because when I run the code to look for the device it returns only empty ([]) and throws no exceptions
from python-seabreeze.
Related Issues (20)
- C seabreeze doesn't report firmware version HOT 1
- Problem with set_integration_time, the spectrometer doesn't wait for spectrum acquisition. HOT 3
- Seabreeze and SR4 Spectrometers HOT 20
- Extract cseabreeze into its own module HOT 1
- Rewrite Transport to use bMaxPacketSize
- ADC1000 error with external interrupt HOT 10
- USB2000 Issue reading intensities HOT 1
- Edge Trigger Issue Continues HOT 3
- QEPro lower intensities compared with OceanView - "hidden" settings? HOT 1
- Flame-S in version 2.4.0 pyseabreeze and trigger mode HOT 2
- Overflow, still alive and well HOT 1
- Getting CPython errors when building from source HOT 1
- Install on raspberry pi HOT 5
- Basic SR2 support HOT 2
- Drivers Dont have valid signatures HOT 8
- Support for SR6 / HR6 HOT 5
- USB2000 and some Flame S error at initialization due to fpga firmware version register check HOT 4
- HDX spectrometer connected via USB errors after manually interrupting connection HOT 2
- Ethernet Support for HDX HOT 6
- OceanHR4 connection issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-seabreeze.