pvachon / gm1356

Tool to read noise level from a USB-connected GM1356 Sound Level Meter
BSD 3-Clause "New" or "Revised" License
14 stars 2 forks source link

I need to reboot my pi each time I run splread #2

Open Roaders opened 1 year ago

Roaders commented 1 year ago

First of all: thank you so much for this repo! I spent a very frustrating weekend trying to get this sound level meter working with my pi and was about to give up when I came across your repo and it enables me to read the data fine so thanks very much!

I do have one pretty annoying issue though - if I run splread and then quite it (using ctrl c in a console) the process stops but I am unable to start it again without rebooting my pi! I get the following when I try to restart it:

SPL-I-STARTUP, Starting the Chinese SPL Meter Reader (splread.c:409 in main)
SPL-I-POLL-INTERVAL, Setting poll interval to 1000 milliseconds (splread.c:365 in _parse_args)
SPL-I-DEVICE, Device found: 64bd:74e3 path: 0001:0003:00 serial: (null) (splread.c:147 in splread_find_device)
SPL-E-REQUEST-FAIL, Failed to write 8 bytes to device (wrote -1): hid_error is not implemented yet (splread.c:215 in splread_send_req)
SPL-F-CONFIG-FAIL, Failed to set configuration for SPL meter, aborting (splread.c:296 in splread_set_config)
SPL-F-BAD-CONFIG, Failed to load configuration, aborting. (splread.c:434 in main)

I am afraid that I know NOTHING about C++ and reading through the code makes very little sense to me! Can you give me any pointers on how to fix this issue?

Many thanks.

Roaders commented 1 year ago

ok, it seems that the issue is that when I think that I've killed the process it's still running. How should I kill this process properly to release the usb device?

Potat0x commented 1 year ago

How exactly you kill process? For me sudo pkill -9 splread or just ^C works properly on Linux Mint 21.1

Roaders commented 1 year ago

using kill -9 seems to work. Ctrl C doesn't

pvachon commented 1 year ago

I just spent some time trying to reproduce this issue but could not. Hitting ^C on a terminal killed splread for me on my test environment (Debian on a modern x86 box). Could there be something funny about your shell where you are backgrounding splread when you launch it? I also could not reproduce this with an OrangePi Zero running Armbian.

What parameters are you launching splread with?

Thanks!

Roaders commented 1 year ago

if I do ctrl C then the process appears to stop (I see no more output) but I am unable to restart it. This is on a raspberry pi with Pi OS. I am just running splread -i 1000 (I think, it's been a while since I ran it). Not doing anything fancy at all. Thanks for the reply.

pvachon commented 1 year ago

Gotcha'. Could you run through the steps to reproduce the issue and give me the output from ps axuw when you are unable to restart spread? If you can also get the PID for any splread processes remaining and include the results of cat-ing /proc/<the pid here>/status that would also help a bunch. Thanks!

Roaders commented 1 year ago

Thanks for looking into this but it's not going to be easy for me to reproduce this now as this is now setup remotely and reporting sound levels. I'd have to do multiple restarts of the device it's plugged into to test and that device is doing other stuff... If I get an opportunity I'll try and do this but it'll probably be a while.