Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beep and laptops #43

Open
galaxysite opened this issue Oct 31, 2024 · 14 comments
Open

beep and laptops #43

galaxysite opened this issue Oct 31, 2024 · 14 comments

Comments

@galaxysite
Copy link

galaxysite commented Oct 31, 2024

Hi,

When finding bug in some program, we touch "beep": mse-org/mseide-msegui#24

Beep show error on laptop:

Fstat failed. Errno : 2
But in my system /dev/input/by-path there are only those:
Screenshot_2024-10-26_14-24-48
$ beep
beep: Error: Could not open any device
PS: I have a laptop, maybe pcspkr cannot be installed.

Maybe add to beep My fast-playing low-level code from: https://github.com/galaxysite/gorg64_spkplay and possible music playing from binary files for x86* architecture ?

@fredvs
Copy link

fredvs commented Nov 2, 2024

Did you test it for laptop (usually they dont have pc speaker output in the mother board)?
I see in your description that Root priveleges are needed, is it still so?
I will test it asap on my laptop.

For msegui (and fpc too) it is a known problem, beep() does not work on lot of Linux laptop.
The work-around that I use is to use libasound.so
https://github.com/fredvs/alsa_sound

@fredvs
Copy link

fredvs commented Nov 2, 2024

Hello.
I did compile spkr-beep but at runing on a XUbuntu 22.04 laptop Lenovo IdeaPad i5 there is that error:

$ sudo ./gorg64_spkplay
GALAXY ORGANIZER SPEAKER PLAYER Version 3
Artyomov Alexander 2021  License: GNU AGPLv3 and above
Use: gorg64_spkplay or gorg64_spkplay somemusic.speaker somemusic2.speaker ...
24321 (process ID) old priority 0, new priority -19
An unhandled exception occurred at $0000000000412A76:
EAccessViolation: Access violation
  $0000000000412A76

And using gdb debugger:

Starting program: /home/fred/gorg64_spkplay-main/gorg64_spkplay 
GALAXY ORGANIZER SPEAKER PLAYER Version 3
Artyomov Alexander 2021  License: GNU AGPLv3 and above
Use: gorg64_spkplay or gorg64_spkplay somemusic.speaker somemusic2.speaker ...
[Detaching after fork from child process 25445]
25442 (process ID) old priority 0, new priority -19

Program received signal SIGSEGV, Segmentation fault.
SPKON () at spkunit.pas:46
46	        in      al, 61h

@galaxysite
Copy link
Author

Not root privileges binary.
Need:

chown root:root gorg64_spkplay
chmod =04755 gorg64_spkplay

@fredvs
Copy link

fredvs commented Nov 3, 2024

I was able to change permission only with sudo:

fred@fred-IdeaPad:~$ cd /home/fred/gorg64_spkplay-main
fred@fred-IdeaPad:~/gorg64_spkplay-main$ chown root:root gorg64_spkplay
chown: changing ownership of 'gorg64_spkplay': Operation not permitted
fred@fred-IdeaPad:~/gorg64_spkplay-main$ sudo chown root:root gorg64_spkplay
[sudo] password for fred: 
fred@fred-IdeaPad:~/gorg64_spkplay-main$ chown root:root gorg64_spkplay
chown: changing ownership of 'gorg64_spkplay': Operation not permitted
fred@fred-IdeaPad:~/gorg64_spkplay-main$ sudo chown root:root gorg64_spkplay
[sudo] password for fred: 
fred@fred-IdeaPad:~/gorg64_spkplay-main$ chmod =04755 gorg64_spkplay
chmod: changing permissions of 'gorg64_spkplay': Operation not permitted
fred@fred-IdeaPad:~/gorg64_spkplay-main$ sudo chmod =04755 gorg64_spkplay

But running via gdb without root permission:

(gdb) r
Starting program: /home/fred/gorg64_spkplay-main/gorg64_spkplay 
GALAXY ORGANIZER SPEAKER PLAYER Version 3
Artyomov Alexander 2021  License: GNU AGPLv3 and above
Use: gorg64_spkplay or gorg64_spkplay somemusic.speaker somemusic2.speaker ...
[Detaching after fork from child process 77479]
renice: failed to set priority for 77476 (process ID): Permission denied

Program received signal SIGSEGV, Segmentation fault.
SPKON () at spkunit.pas:46
46	        in      al, 61h
(gdb)

And running with root permission:

gdb) r
Starting program: /home/fred/gorg64_spkplay-main/gorg64_spkplay 
GALAXY ORGANIZER SPEAKER PLAYER Version 3
Artyomov Alexander 2021  License: GNU AGPLv3 and above
Use: gorg64_spkplay or gorg64_spkplay somemusic.speaker somemusic2.speaker ...
[Detaching after fork from child process 77646]
77643 (process ID) old priority 0, new priority -19

Program received signal SIGSEGV, Segmentation fault.
SPKON () at spkunit.pas:46
46	        in      al, 61h
(gdb) 

@galaxysite
Copy link
Author

Without set uid by root system not give access to I/O (function ioperm fails and "in" operation blocked).

If not working sudo need su.

gdb not have root access.

@fredvs
Copy link

fredvs commented Nov 3, 2024

In XUbuntu su does not work, the equivalent is sudo -i

fred-IdeaPad:~# sudo -i
root@fred-IdeaPad:~# /home/fred/gorg64_spkplay-main/gorg64_spkplay
GALAXY ORGANIZER SPEAKER PLAYER Version 3
Artyomov Alexander 2021  License: GNU AGPLv3 and above
Use: gorg64_spkplay or gorg64_spkplay somemusic.speaker somemusic2.speaker ...
79263 (process ID) old priority 0, new priority -19
An unhandled exception occurred at $0000000000459916:
EAccessViolation: Access violation
  $0000000000459916  SPKON,  line 45 of spkunit.pas

@galaxysite
Copy link
Author

sudo -i ?
May be... But after sudo -i who say chown ?

Need rights:
ls -l ./gorg64_spkplay
-rwsr-xr-x 1 root root 17544 ноя 2 20:57 ./gorg64_spkplay

@fredvs
Copy link

fredvs commented Nov 3, 2024

root@fred-IdeaPad:~#  ls -l /home/fred/gorg64_spkplay-main/gorg64_spkplay
-rwsr-xr-x 1 root root 1183448 nov  2 18:30 /home/fred/gorg64_spkplay-main/gorg64_spkplay

@galaxysite
Copy link
Author

1183448 strange numbers. But the rest is correct. Maybe it's a feature of Ubuntu?
And then run.

@galaxysite
Copy link
Author

I update https://github.com/galaxysite/gorg64_spkplay and GORG: http://soft.self-made-free.ru/GORG64_283.tar.xz

Added functions getuid/geteuid and setuid. This might improve clarity at startup and add some features.

@fredvs
Copy link

fredvs commented Nov 3, 2024

I update https://github.com/galaxysite/gorg64_spkplay

Free Pascal Compiler OOTB v. 3.2.4_glibc225 [2024/07/30] for x86_64
Copyright (c) 1993-2024 by Florian Klaempfl & friends.
Target OS: Linux for x86-64
Compiling gorg64_spkplay.pas
Compiling spkunit.pas
gorg64_spkplay.pas(32,43) Fatal: Can't find unit urun used by gorg64_spkplay_syscalls
Fatal: Compilation aborted

@galaxysite
Copy link
Author

Yes, I add urun and urunu in github.

@fredvs
Copy link

fredvs commented Nov 3, 2024

OK, I will try after the fight with rust.
Note that now I am disconnected after you have change the locale to english.
When I try to reconnect it say that you are offline.

@fredvs
Copy link

fredvs commented Nov 4, 2024

Yes, I add urun and urunu in github.

....
Compiling gorg64_spkplay.pas
Compiling spkunit.pas
Compiling urun.pas
gorg64_spkplay.pas(94,4) Error: Identifier not found "portserr"
gorg64_spkplay.pas(156,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants