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

Any chances on making a combo for turning off the screen? #5

Open
Varon9 opened this issue Jan 8, 2019 · 13 comments
Open

Any chances on making a combo for turning off the screen? #5

Varon9 opened this issue Jan 8, 2019 · 13 comments

Comments

@Varon9
Copy link

Varon9 commented Jan 8, 2019

Basically os that, the plugin it's amazing un addition of DS3 vita but It Would be so nice to can turn off the screen while playing.
Thanks so much!

@xerpi
Copy link
Owner

xerpi commented Jan 8, 2019

If you have VITASDK installed you can try this patch: https://pastebin.com/raw/wK8fent0

@Varon9
Copy link
Author

Varon9 commented Jan 8, 2019

Is It ready to compile ir do i need todo copypaste un one of the files?

@xerpi
Copy link
Owner

xerpi commented Jan 8, 2019

It's a patch file, but since it's a bit old I doubt it still applies so you have to apply the changes to each file manually.

@Varon9
Copy link
Author

Varon9 commented Jan 8, 2019

Oh i see, i'll try It tomorrow if i manage yo patchwork It properly, thanks so much!

@Varon9
Copy link
Author

Varon9 commented Jan 8, 2019

I managed to patch It manually and works like a charm! Thanks so much xerpi!!

@xerpi
Copy link
Owner

xerpi commented Jan 8, 2019

Nice, I'm glad it works.

Maybe using ksceOledDisplayOn / ksceOledDisplayOff instead of the brightness functions would also work, and if it does, it will save more power.

@Varon9
Copy link
Author

Varon9 commented Jan 8, 2019

I'll check if i can do It, because i'm actually suprised that It worked in the first try since i haven't any idea on programming but, there's allways a first time 😅

@xerpi
Copy link
Owner

xerpi commented Jan 8, 2019

Oh haha then it's quite a feat if you managed to apply the patch and get it working without knowing how to program 😛

@Varon9
Copy link
Author

Varon9 commented Jan 8, 2019

I'll unlock a trophy if i manage to implement those two "instructions?" Haha 😅

@Varon9
Copy link
Author

Varon9 commented Jan 9, 2019

it almost worked, i mean with ksceOledDisplayOn/Off, but it turns off the oled then turns on inmediatly, don't know why.
static int uvc_udcd_attach(int usb_version, void *user_data)
{
LOG("uvc_udcd_attach %d\n", usb_version);

ksceOledDisplayOff();

ksceUdcdClearFIFO(&endpoints[2]);

return 0;

}

static void uvc_udcd_detach(void *user_data)
{
LOG("uvc_udcd_detach\n");
ksceOledDisplayOn();
uvc_handle_video_abort();
}
this is what i did

@Varon9
Copy link
Author

Varon9 commented Jan 9, 2019

forget about it, it was an stupid mistake of mine, it turned off then on because no capturing program was runing, i started potplayer then opened vita and voilá, screen is off permanently till usb disconects

@Emiougus
Copy link

Emiougus commented Jun 25, 2019

What version are you running on? I attempted this with my Vita 2000 on 3.65 added ksceLcdDisplayOff(); to uvc-udcd-attach and ksceLcdDisplayOn(); to uvc-udcd-detach. Display turned off fine and functioned as it should've but when I unplugged the cord the display stayed off, I tried multiple things and noticed that if I put ksceLcdDisplayOff(); under uvc-udcd-detach and remove it from uvc-udcd-attach the display still turns off, this leads me to believe that uvc_udcd_detach is called when the cable is plugged in therefore causing it to bug and just stay off? I'm new to this kinda stuff sorry if I'm using the wrong terminology.

Edit: after a bit more tinkering, I'm fairly certain that ksceLcdDisplayOn doesn't work either on 3.65 or just entirely. Doesn't make sense though as ksceLcdDisplayOff works perfectly fine.

Update: Found a fix(for anyone who's looking for it),

SceUID uvc_frame_req_evflag;

int ksceLcdDisplayOff();
int ksceLcdDisplayOn();

int ksceLcdGetBrightness();
int ksceLcdSetBrightness(unsigned int brightness);
static unsigned int initial_brightness = 1;

and

static int uvc_udcd_attach(int usb_version, void *user_data)
{
	LOG("uvc_udcd_attach %d\n", usb_version);
	
	initial_brightness = ksceLcdGetBrightness();
	ksceLcdDisplayOff();

	ksceUdcdClearFIFO(&endpoints[2]);

	return 0;
}

static void uvc_udcd_detach(void *user_data)
{
	LOG("uvc_udcd_detach\n");

	ksceLcdSetBrightness(initial_brightness);
	
	/* ksceLcdDisplayOn(); Not Working*/  

	uvc_handle_video_abort();
}

I guess setting the brightness wakes the screen up and the DisplayOff function works so it's all good :)

@xerpi
Copy link
Owner

xerpi commented Jul 30, 2019

Implemented 3 different versions: https://github.com/xerpi/vita-udcd-uvc/releases

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