forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PS3 Controller in PS3 Linux

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development
View previous topic :: View next topic  
Author Message
RetroGamer



Joined: 07 Nov 2006
Posts: 11

PostPosted: Sun Jan 21, 2007 1:08 pm    Post subject: PS3 Controller in PS3 Linux Reply with quote

Is the PS3 Controller supported in Gentoo at all? I haven't installed Gentoo yet, and I don't want to bother if it doesn't support the PS3 [yet].
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sun Jan 21, 2007 4:23 pm    Post subject: Reply with quote

The SIXAXIS works as a USB HID device when attached via USB; it does not work via bluetooth, nor does the motion sensing work. Both should come someday.
Back to top
View user's profile Send private message
edepot



Joined: 09 Apr 2005
Posts: 111

PostPosted: Mon Jan 22, 2007 2:02 am    Post subject: sixaxis under gentoo linux on ps3 Reply with quote

The following is a patch for the debian linux kernel 2.6.18
Using the wiki on the main page at ps2dev.org to install
gentoo, is the following patch needed? or do you just plug it
in and it should work without patching? is there a joystick test
utility the you can emerge in gentoo to verify that the joystick
works? and how about some code that can capture input?










diff -ur linux-source-2.6.18.orig/drivers/usb/input/hid-core.c linux-source-2.6.18/drivers/usb/input/hid-core.c
--- linux-source-2.6.18.orig/drivers/usb/input/hid-core.c 2006-09-19 23:42:06.000000000 -0400
+++ linux-source-2.6.18/drivers/usb/input/hid-core.c 2006-11-29 03:24:35.000000000 -0500
@@ -446,6 +446,15 @@
data = (parser->global.usage_page << 16) + data;

parser->local.usage_minimum = data;
+ if (parser->local.usage_maximum_defined) {
+ for (n = parser->local.usage_minimum; n <= parser->local.usage_maximum; n++)
+ if (hid_add_usage(parser, n)) {
+ dbg("hid_add_usage failed\n");
+ return -1;
+ }
+ } else {
+ parser->local.usage_minimum_defined = 1;
+ }
return 0;

case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
@@ -458,11 +467,16 @@
if (item->size <= 2)
data = (parser->global.usage_page << 16) + data;

- for (n = parser->local.usage_minimum; n <= data; n++)
- if (hid_add_usage(parser, n)) {
- dbg("hid_add_usage failed\n");
- return -1;
- }
+ parser->local.usage_maximum = data;
+ if (parser->local.usage_minimum_defined) {
+ for (n = parser->local.usage_minimum; n <= parser->local.usage_maximum; n++)
+ if (hid_add_usage(parser, n)) {
+ dbg("hid_add_usage failed\n");
+ return -1;
+ }
+ } else {
+ parser->local.usage_maximum_defined = 1;
+ }
return 0;

default:
@@ -1583,6 +1597,7 @@
#define USB_DEVICE_ID_LD_POWERCONTROL 0x2030
#define USB_DEVICE_ID_LD_MACHINETEST 0x2040

+#define USB_VENDOR_ID_SONY 0x054c
#define USB_VENDOR_ID_APPLE 0x05ac
#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304

@@ -1741,6 +1756,7 @@
{ USB_VENDOR_ID_APPLE, 0x0219, HID_QUIRK_POWERBOOK_HAS_FN },
{ USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN },
{ USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_SONY, 0x0268, HID_QUIRK_PS3 },

{ USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE },
@@ -1807,6 +1823,30 @@
}
}

+static void hid_fixup_ps3(struct usb_device * dev, int ifnum)
+{
+ char * buf;
+ int ret;
+
+ buf = kmalloc(18, GFP_KERNEL);
+ if (!buf)
+ return;
+
+ ret = usb_control_msg(dev,
+ usb_rcvctrlpipe(dev, 0),
+ HID_REQ_GET_REPORT,
+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+ (3 << 8) | 0xf2,
+ ifnum,
+ buf,
+ 17,
+ USB_CTRL_GET_TIMEOUT);
+ if (ret < 0)
+ printk(KERN_ERR "%s: ret=%d\n", __FUNCTION__, ret);
+
+ kfree(buf);
+}
+
static struct hid_device *usb_hid_configure(struct usb_interface *intf)
{
struct usb_host_interface *interface = intf->cur_altsetting;
@@ -2074,6 +2114,9 @@
return -ENODEV;
}

+ if ((hid->quirks & HID_QUIRK_PS3))
+ hid_fixup_ps3(hid->dev, hid->ifnum);
+
printk(KERN_INFO);

if (hid->claimed & HID_CLAIMED_INPUT)
diff -ur linux-source-2.6.18.orig/drivers/usb/input/hid.h linux-source-2.6.18/drivers/usb/input/hid.h
--- linux-source-2.6.18.orig/drivers/usb/input/hid.h 2006-09-19 23:42:06.000000000 -0400
+++ linux-source-2.6.18/drivers/usb/input/hid.h 2006-11-28 14:34:55.000000000 -0500
@@ -260,6 +260,7 @@
#define HID_QUIRK_POWERBOOK_HAS_FN 0x00001000
#define HID_QUIRK_POWERBOOK_FN_ON 0x00002000
#define HID_QUIRK_INVERT_HWHEEL 0x00004000
+#define HID_QUIRK_PS3 0x00008000

/*
* This is the global environment of the parser. This information is
@@ -293,8 +294,11 @@
unsigned collection_index[HID_MAX_USAGES]; /* collection index array */
unsigned usage_index;
unsigned usage_minimum;
+ unsigned usage_maximum;
unsigned delimiter_depth;
unsigned delimiter_branch;
+ int usage_minimum_defined;
+ int usage_maximum_defined;
};

/*
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Mon Jan 22, 2007 6:27 am    Post subject: Reply with quote

The PS3 Linux kernel already has the required patches. It is a standard joystick device, there's nothing special that needs to be done. http://gentoo-wiki.com/HOWTO_Joystick_Setup
Back to top
View user's profile Send private message
RetroGamer



Joined: 07 Nov 2006
Posts: 11

PostPosted: Mon Jan 22, 2007 6:37 am    Post subject: Reply with quote

Is there a way to map a keyboard's keys to the PS3 Controller in Linux. I want to run an N64 Emulator and play all the old roms of games I used to have using a more 'familiar' controller than using a keyboard. Any ideas?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Mon Jan 22, 2007 9:10 am    Post subject: Reply with quote

That would require either that the emulator you're running has joystick support, or use of a tool to translate joystick to keyboard input. According to Google there are many tools that can do that: qjoypad, gizmod, joy2key..
Back to top
View user's profile Send private message
RetroGamer



Joined: 07 Nov 2006
Posts: 11

PostPosted: Mon Jan 22, 2007 2:10 pm    Post subject: Reply with quote

I like what I hear, I'll look into that!
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Jan 22, 2007 2:46 pm    Post subject: Reply with quote

QJoypad is my favorite. Works great with Playstation controllers (in my case, I use it with a dual-shock in Fedora Core on a regular PC).
Back to top
View user's profile Send private message AIM Address
pseudonimo



Joined: 14 Aug 2008
Posts: 5

PostPosted: Fri Aug 15, 2008 6:03 am    Post subject: Reply with quote

Seems like it's possible now: http://www.pabr.org/sixlinux/sixlinux.en.html
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group