DRIVERS HELP

Talk about anything related to Gentoox or Gentoo.
Post Reply
XmodX
Newbie
Posts: 3
Joined: Mon Apr 05, 2004 6:56 pm

DRIVERS HELP

Post by XmodX »

ok, im a little bit newb, but i know a good bit, enough to get Linux running on my xbox. But, heres my situation: Im getting ready to leave on a 2 week boat trip down the east coast. I have limited space on my 28' boat, and i want to use the xbox for everything--jukebox, pc with internet, etc. I have been planning on using a pocket pc with my sprint phone for an internet connection. but thats a pain in the ass. I found a new usb cable for my sprint, that will let me use it as a usb modem on a pc. The company's website has drivers for windows and i downloaded them and it works great, its even faster than i expected. But how can i get or write or have someone help me write a driver for Linux on the xbox? I have 2 usb ports installed on my xbox, 160gb maxtor, and all the extras. It would be so cool to have usb modem on my boat! if not, im gonna have to take a pc and monitor, which sucks, as space is very limited on a boat. the xbox fits fine right on top of my 13" tv and would make a great all purpose machine. Please help.
XmodX
Newbie
Posts: 3
Joined: Mon Apr 05, 2004 6:56 pm

no help?

Post by XmodX »

No one can even make a suggestion? i guess i would need to know how to write dll's to make a driver. doesnt matter at this point. I just bought a laptop.

Order detail - order placed 2004-04-11 22:36:06

Inspiron 9100
Intel® Pentium® 4 w/ HT Technology 3.0GHz, 15.4-in. WXGA, Microsoft® Windows® XP Professional Qty: 1
Unit Price: $1,816.00
Inspiron 9100 Intel® Pentium® 4 w/ HT Technology 3.0GHz, 15.4-in. WXGA
N30MHN
[221-4990]

Memory FREE UPGRADE! 512MB,400MHz,2DIMM (from 256MB,400MHz,1DIMM)
512MB2P
[462-8552]

Video Card 128MB DDR ATI's MOBILITY™ RADEON™ 9700 AGP 8X Graphics
128ATI
[312-0184]

Hard Drive 60GB Hard Drive at 7200RPM
60GB72
[341-0538]

Operating System Microsoft® Windows® XP Professional
WPXP
[412-0408]
[420-3842]

CD ROM/DVD ROM 24X CD-RW/DVD Combo Drive with Sonic RecordNow
24COMBO
[341-0541]

Wireless Networking Cards Wireless Option Chosen
BLUETOOTH
[430-0799]

Productivity Software Productivity Pack including WordPerfect® and Money®
ICOREL
[412-0398]
[412-0552]
[412-0556]

Security Software Dell SecurityCenter by McAfee, 90-day introductory offer
MCAFE90
[412-0636]

Digital Music Dell™ Jukebox Plus powered by MusicMatch - Basic
MMBASE
[412-0516]

Primary Battery 96 WHr 12-cell Primary Battery with Subwoofer
12BAT
[310-8836]

Limited Warranty, Services and Support 1 Year Limited Warranty plus 1 Year Mail-In Service
ST111RR
[950-9057]
[950-3337]
[950-3830]
[412-0361]

Dial-Up Internet Access 6 Months of America Online Membership Included
AOLDHS
[412-0625]
[412-0587]
[420-3224]

Digital Imaging Software Dell™ Picture Studio™ Paint Shop Pro
DPS
[412-0521]

Multi-Media Players RealOne™ Player, with 14 day SuperPass trial
REALBAS
[410-0207]

Color Kits Burlwood QuickSnap™ Cover
WOOD
[311-3432]

Dell Media Experience Dell™ Media Experience
DMX
[410-0244]






forget the linux thing, although its cool. I will just use my new laptop on the boat.
Trogdor
Gentoox Guru!
Posts: 553
Joined: Tue Oct 07, 2003 9:57 pm
Location: MOUNT TAPE U1439 ON B3, NO RING

Re: no help?

Post by Trogdor »

XmodX wrote:No one can even make a suggestion? i guess i would need to know how to write dll's to make a driver.
WOW! You must be an incredible programmer if you invented DLLs for Linux! </sarcasm> Anyways, a driver is not something one can write on a weekend.
MOUNT TAPE U1439 ON B3, NO RING

Q: HOW DO I RUN MAGIC ??
A: You run magic by not typing in capital letters.
XmodX
Newbie
Posts: 3
Joined: Mon Apr 05, 2004 6:56 pm

u r right

Post by XmodX »

yeah, i know. that was stupid. im not a linux programmer, so excuse my ignorance. but there must be an equivalent for linux. i give up.
Trogdor
Gentoox Guru!
Posts: 553
Joined: Tue Oct 07, 2003 9:57 pm
Location: MOUNT TAPE U1439 ON B3, NO RING

Re: u r right

Post by Trogdor »

XmodX wrote:yeah, i know. that was stupid. im not a linux programmer, so excuse my ignorance. but there must be an equivalent for linux. i give up.
I was just joking there, but seriously, a driver isn't an easy thing to write. Even something as simple as a usb light driver is rather challanging. Here is an example of that driver (in the kernel 2.6 tree):

Code: Select all

/*
 * USB LED driver - 1.1
 *
 * Copyright (C) 2004 Greg Kroah-Hartman (greg@kroah.com)
 *
 *	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, version 2.
 *
 */

#include <linux/config.h>
#ifdef CONFIG_USB_DEBUG
	#define DEBUG	1
#endif
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/usb.h>


#define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com"
#define DRIVER_DESC "USB LED Driver"

#define VENDOR_ID	0x0fc5
#define PRODUCT_ID	0x1223

/* table of devices that work with this driver */
static struct usb_device_id id_table [] = {
	{ USB_DEVICE(VENDOR_ID, PRODUCT_ID) },
	{ },
};
MODULE_DEVICE_TABLE (usb, id_table);

struct usb_led {
	struct usb_device *	udev;
	unsigned char		blue;
	unsigned char		red;
	unsigned char		green;
};

#define BLUE	0x04
#define RED	0x02
#define GREEN	0x01
static void change_color(struct usb_led *led)
{
	int retval;
	unsigned char color = 0x07;
	unsigned char *buffer;

	buffer = kmalloc(8, GFP_KERNEL);
	if (!buffer) {
		dev_err(&led->udev->dev, "out of memory\n");
		return;
	}

	if (led->blue)
		color &= ~(BLUE);
	if (led->red)
		color &= ~(RED);
	if (led->green)
		color &= ~(GREEN);
	dev_dbg(&led->udev->dev,
		"blue = %d, red = %d, green = %d, color = %.2x\n",
		led->blue, led->red, led->green, color);

	retval = usb_control_msg(led->udev,
				usb_sndctrlpipe(led->udev, 0),
				0x12,
				0xc8,
				(0x02 * 0x100) + 0x0a,
				(0x00 * 0x100) + color,
				buffer,	
				8,
				2 * HZ);
	if (retval)
		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
	kfree(buffer);
}

#define show_set(value)	\
static ssize_t show_##value(struct device *dev, char *buf)		\
{									\
	struct usb_interface *intf = to_usb_interface(dev);		\
	struct usb_led *led = usb_get_intfdata(intf);			\
									\
	return sprintf(buf, "%d\n", led->value);			\
}									\
static ssize_t set_##value(struct device *dev, const char *buf, size_t count)	\
{									\
	struct usb_interface *intf = to_usb_interface(dev);		\
	struct usb_led *led = usb_get_intfdata(intf);			\
	int temp = simple_strtoul(buf, NULL, 10);			\
									\
	led->value = temp;						\
	change_color(led);						\
	return count;							\
}									\
static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
show_set(blue);
show_set(red);
show_set(green);

static int led_probe(struct usb_interface *interface, const struct usb_device_id *id)
{
	struct usb_device *udev = interface_to_usbdev(interface);
	struct usb_led *dev = NULL;
	int retval = -ENOMEM;

	dev = kmalloc(sizeof(struct usb_led), GFP_KERNEL);
	if (dev == NULL) {
		dev_err(&interface->dev, "Out of memory\n");
		goto error;
	}
	memset (dev, 0x00, sizeof (*dev));

	dev->udev = usb_get_dev(udev);

	usb_set_intfdata (interface, dev);

	device_create_file(&interface->dev, &dev_attr_blue);
	device_create_file(&interface->dev, &dev_attr_red);
	device_create_file(&interface->dev, &dev_attr_green);

	dev_info(&interface->dev, "USB LED device now attached\n");
	return 0;

error:
	kfree(dev);
	return retval;
}

static void led_disconnect(struct usb_interface *interface)
{
	struct usb_led *dev;

	dev = usb_get_intfdata (interface);
	usb_set_intfdata (interface, NULL);

	device_remove_file(&interface->dev, &dev_attr_blue);
	device_remove_file(&interface->dev, &dev_attr_red);
	device_remove_file(&interface->dev, &dev_attr_green);

	usb_put_dev(dev->udev);

	kfree(dev);

	dev_info(&interface->dev, "USB LED now disconnected\n");
}

static struct usb_driver led_driver = {
	.owner =	THIS_MODULE,
	.name =		"usbled",
	.probe =	led_probe,
	.disconnect =	led_disconnect,
	.id_table =	id_table,
};

static int __init usb_led_init(void)
{
	int retval = 0;

	retval = usb_register(&led_driver);
	if (retval)
		err("usb_register failed. Error number %d", retval);
	return retval;
}

static void __exit usb_led_exit(void)
{
	usb_deregister(&led_driver);
}

module_init (usb_led_init);
module_exit (usb_led_exit);

MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
MOUNT TAPE U1439 ON B3, NO RING

Q: HOW DO I RUN MAGIC ??
A: You run magic by not typing in capital letters.
Post Reply