也许是当年ps3 可以安装yellow dog 的原因,现在kernel包直接包含了ds3(sixaxis)的驱动。
如果要让ds3 在linux 下工作需要两个部分:
1. HID –人体工程学接口设备, 鼠标,键盘及其他控制器都需要它。它遵循HID驱动构架。仅处理模块初始化和设备的探测(probe)
具体位置在: drivers/hid/hid-sony.c / * HID driver for some sony “special” devices
*
* Copyright (c) 1999 Andreas Gal
* Copyright (c) 2000-2005 Vojtech Pavlik
* Copyright (c) 2005 Michael Haboustak for Concept2, Inc
* Copyright (c) 2007 Paul Walmsley
* Copyright (c) 2008 Jiri Slaby
* Copyright (c) 2006-2008 Jiri Kosina
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*/
#include
#include
#include
#include
#include
#include “hid-ids.h”
…
static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
unsigned long quirks = id->driver_data;
struct sony_sc *sc;
…
switch (hdev->bus) {
case BUS_USB:
ret = sony_set_operational_usb(hdev);
break;
case BUS_BLUETOOTH:
ret = sony_set_operational_bt(hdev);
break;
default:
ret = 0;
…
hid-ids.h 包含ds3 的vid ,pid
#define USB_VENDOR_ID_SONY 0x054c
#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
kernel 默认把这个hid-sony 包含进内核,而不是模块形式。 CONFIG_HID_SONY=y
2. input –这个是kernel 2.6以后抽象出来的,专门处理具体输入输出外设事件。input作为设备作业流的最后一个环节他将I/O外设分为这几类:
obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/
obj-$(CONFIG_INPUT_MOUSE) += mouse/
obj-$(CONFIG_INPUT_JOYSTICK) += joystick/
obj-$(CONFIG_INPUT_TABLET) += tablet/
obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
obj-$(CONFIG_INPUT_MISC) += misc/
手柄控制器就属于 joystick 。然后在joystick 有专门处理一种手柄/摇杆的驱动。对应DS3的就是gamecon.c
/*
* NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux
*
* Copyright (c) 1999-2004 Vojtech Pavlik
* Copyright (c) 2004 Peter Nelson
*
* Based on the work of:
* Andree Borrmann John Dahlstrom
* David Kuder Nathan Hand
* Raphael Assenat
*/
看注释不知道像NES这样的古老非usb手柄怎么在linux上面用~ 作者还有文档呢:
/*
* PSX support
*
* See documentation at:
* http://www.geocities.co.jp/Playtown/2004/psx/ps_eng.txt
* http://www.gamesx.com/controldata/psxcont/psxcont.htm
*
*/
赞过:
赞 正在加载……
相关