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

libsysio pad actuators (was: libsysfs does not work) #19

Open
jjolano opened this issue May 9, 2011 · 8 comments
Open

libsysio pad actuators (was: libsysfs does not work) #19

jjolano opened this issue May 9, 2011 · 8 comments

Comments

@jjolano
Copy link

jjolano commented May 9, 2011

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.

@shagkur
Copy link
Member

shagkur commented May 9, 2011

Could you provide a test case? Thanks

@jjolano
Copy link
Author

jjolano commented May 9, 2011

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;
}

@shagkur
Copy link
Member

shagkur commented May 10, 2011

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?

@jjolano
Copy link
Author

jjolano commented May 10, 2011

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.

@jjolano
Copy link
Author

jjolano commented May 10, 2011

btw I was using PSL1GHT commit 72755bc
maybe your latest commit called "link script adjustments" did something? i'll play around a bit

@CrashSerious
Copy link

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.

@CrashSerious
Copy link

Correction. There was a commit to ps3libraries 5 hours ago. I have NOT tested that yet, didn't realize it was there.

@jjolano
Copy link
Author

jjolano commented May 28, 2011

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

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

3 participants