libsysio pad actuators (was: libsysfs does not work)
jjolano opened this issue · 8 comments
The functions for libsysfs (sysFs*
) crash the ps3 when used. (libsysfs is in the LIBS, of course - otherwise it wouldn't compile)
However the sysLv2Fs*
syscall equivalents work fine though.
Could you provide a test case? Thanks
you mean something like this?
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <ppu-types.h>
#include <sys/file.h>
// Makefile LIBS: -lrt -llv2 -lsysfs
int main()
{
sysFSStat stat;
if(sysLv2FsStat("/dev_flash", &stat) == 0)
{
// no crashing
printf("win\n");
}
if(sysFsStat("/dev_flash", &stat) == 0)
{
// crashed!
printf("this will never execute");
}
return 0;
}
Hi,
i just tried your test case and it worked like a charm for me:
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <ppu-types.h>
#include <sys/file.h>
// Makefile LIBS: -lrt -llv2 -lsysfs
int main()
{
s32 ret;
sysFSStat stat;
ret = sysLv2FsStat("/dev_flash", &stat);
if( ret == 0)
{
// no crashing
printf("win\n");
} else
printf("error: %08x\n",ret);
ret = sysFsStat("/dev_flash", &stat);
if(ret == 0)
{
// crashed!
printf("this will never execute\n");
} else
printf("error: %08x\n",ret);
return 0;
}
What you forgot, and hence why you think it's crashing is the '\n' in the // crashed! section. Not putting a \n a the end of your printf line wont flush it to the output.
Btw. what FW version do you use?
tbh, I haven't tested the example code I posted above (was a quick write up) - but if it actually works, then I'm probably missing something.
Here's a homebrew that I was actually using these sysfs functions on: http://git-hacks.com/openps3ftp/openps3ftp
Before posting this issue, I was trying to find the problem in my program because it kept crashing on code that I thought would work just fine. I made a few "checkpoints" and found out calling a sysFsOpendir
(or any sysfs function) on a valid path crashed the thread.
my Makefile LIBS used to be this:
LIBS := -lrsx -lgcm_sys -lsysutil -lrt -llv2 -lnet -lnetctl -lsysfs -lsysmodule
but since the sysfs functions didn't seem to work, I have removed -lsysfs and replaced all the sysfs functions with the syscall ones.
maybe i'm missing something here? not sure.
PS3 FW: 3.55 (MFWBuilder)
An older version of my homebrew (v2.1.1) works fine and is using the sysfs functions. It was compiled with PSL1GHT v1.
btw I was using PSL1GHT commit 72755bc
maybe your latest commit called "link script adjustments" did something? i'll play around a bit
jjolano,
I Just did a git clone on that git mentioned above, with the latest ps3toolchain, ps3libraries, psl1ght, et al... and it compiles and runs like a champ.
I was able to "mget" the /dev_usb000/data-revoke/ directory from the PS3 to my local system and then "mput" the directory to /dev_usb/ on the PS3. (my flash drive plugged into it.
Correction. There was a commit to ps3libraries 5 hours ago. I have NOT tested that yet, didn't realize it was there.
hmm. I'll try using sysfs again some other time (whenever necessary). the syscall equivalents work for now :P
on another note (on the topic of libs not working), libsysio pad actuators don't seem to function - maybe it's just me, but I'm sure that it isn't because I did a very identical port of my homebrew called "PSVibe" to PSL1GHT v2. I even tried just creating a program that sets both actuators on on all connected controllers but doesn't work. Button reading from paddata works however. This probably should be in another issue lol