From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.62) (envelope-from ) id 1I2p5o-00081I-FP for garchives@archives.gentoo.org; Mon, 25 Jun 2007 13:59:01 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l5PDvhJ6008198; Mon, 25 Jun 2007 13:57:43 GMT Received: from smtp10.unit.tiscali.de (smtp10.unit.tiscali.de [213.205.33.46]) by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l5PDrZFw003507 for ; Mon, 25 Jun 2007 13:53:35 GMT Received: from homer_gentoo64.phheimnetz (89.57.75.87) by smtp10.unit.tiscali.de (7.3.121) (authenticated as florian.philipp@tiscali.de) id 46703CF8001AE3C3 for gentoo-user@lists.gentoo.org; Mon, 25 Jun 2007 15:53:35 +0200 From: Florian Philipp To: gentoo-user@lists.gentoo.org Subject: [gentoo-user] Problem with open source driver Devolo dLAN USB Date: Mon, 25 Jun 2007 15:53:24 +0200 User-Agent: KMail/1.9.5 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1373337.UXWQFXpfWL"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200706251553.27620.f.philipp@addcom.de> X-Archives-Salt: a9640b3c-2ce0-4a85-b3c6-b8652907f6a0 X-Archives-Hash: 8ead7fe7cc68e4cd57d0f2e75cb74c75 --nextPart1373337.UXWQFXpfWL Content-Type: multipart/mixed; boundary="Boundary-01=_Uj8fG2971phPZwc" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_Uj8fG2971phPZwc Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi! Currently I'm trying to istall a Devolo dLAN-USB adapter, also known as Pow= er=20 Line. [1] They even provide an open source driver for Linux as a 400kb tarball [2].=20 Unfortunately "make" isn't successful (see make_1.txt). I'll attach the=20 problematic devolo_usb.c file and their readme, too. I hope you can help me. Thanks in advance! =46lorian Philipp [1] http://en.wikipedia.org/wiki/Power_line_communication [2]=20 http://download.devolo.biz/webcms/0518732001164965747/dLAN-linux-package-v3= =2Etar.gz --Boundary-01=_Uj8fG2971phPZwc Content-Type: text/plain; charset="us-ascii"; name="README" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="README" README file for USB drivers and dlanconfig for devolo dLAN;=20 tested under SUSE Linux and Debian Linux=20 with kernel versions 2.4 and 2.6 01.03.2005 =2D------------------------------------------------------------------------= =2D------ Contents 1. Overview =20 2. Requirements=09 2.1 SUSE 2.2 Debian 2.3 libpcap =09 3. USB-driver installation (for USB connection) and the configuration program dlanconfig 3.1 Unpack the compressed tar file 3.2 Installation =09 4. dLAN duo 4.1 Configuration - one-time application=20 (e.g. to test the installation) 4.2 Configuration under SUSE Linux =97 permanent installation=09 4.3 Configuration under Debian Linux =97 permanent installation =09 5. dlanconfig =20 5.1 Change password 5.2 Overview of the dLAN network =2D------------------------------------------------------------------------= =2D------ 1. Overview This readme file contains information about installing the USB driv= er=20 and the configuration program dlanconfig under SUSE Linux and=20 Debian Linux. We also describe the configuration of the dLAN adapters. The dLAN duo can be connected either via Ethernet or USB ports. If both are installed, USB has priority. =09 More detailed information about Linux commands is available in the=20 man pages. These are accessed by entering: man ifconfig. =20 =09 =2D------------------------------------------------------------------------= =2D------ 2. Requirements =09 First of all check that your system and installation are optimised: 2.1 SUSE SUSE users can use the YAST program to set up the required system=20 components or to check that they are selected in advance. Use the S= USE=20 menu system to select -> Yast and enter your =93root=94 password. I= n the=20 selection dialogue 'Install and Remove software' choose the 'Select= ions'=20 filter for a list of all of the system components.=20 To install the USB driver and the configuration program dlanconfig,= =20 the following system components must be selected:=20 =20 'C/C++ Compiler and Tools'=20 =09 'Kernel Development' (for installing the USB driver) 2.2 Debian Debian users wishing to install the USB driver need the appropriate=20 kernel-headers-xxx, which must be installed in advance. You will fi= nd=20 the exact description (e.g. kernel-headers-2.4.27) by entering=20 'uname -a'. Type in the following command to install the kernel=20 headers: =09 apt-get install kernel-headers-xxx=20 Depending on the configuration, the subsequent installation takes place=20 either automatically from the CD or from the Internet, assuming you= =20 have access. 2.3 libpcap libpcap is a library used by network sniffer programs. It offers these=20 programs an interface for processing and analysing data packets in= =20 networks. You will need this library if you translate or write this= =20 type of software yourself or if you wish to use the dlanconfig=20 configuration program.=20 Under SuSE Linux, the latest libpcap library is installed as standard.=20 We advise you to check you installation anyway. Debian users will have to install the libpcab library themselves. Do=20 this by entering the following command: =09 apt-get install libpcap0.8-dev=20 Depending on the configuration, the subsequent installation takes place=20 either automatically from the CD or from the Internet, assuming you= have=20 access.=20 Note: The devolo package includes a source text version of the libpcap=20 library. You should use this source text version if you have a diff= erent=20 distribution which does not include libpcap. =20 =20 =2D------------------------------------------------------------------------= =2D------ 3. USB-driver installation (for USB connection) and the configuration prog= ram dlanconfig 3.1 Unpack the compressed tar file The following command unpacks the compressed tar file on your local=20 computer: =09 tar xzvf dLAN-linux-package-1.2.tar.gz 3.2 Installation After unpacking the tar file, change to the subdirectory dlanconfig and=20 continue with the installation as follows: There are three ways to carry out the installation: - The dLAN configuration program dlanconfig only - The USB driver for dLAN duo only - The dLAN configuration program dlanconfig and the USB driver To install the program dlanconfig only: =09 ./configure=20 =09 make cfgtool =09 make install-cfgtool (as root) =09 To install the USB driver for dLAN duo only: ./configure=20 =09 make usbdriver =09 make install-usbdriver (as root) To install dlanconfig and the USB driver: ./configure=20 =09 make =09 make install (as root) =09 Note: Entering the following command will cause the USB driver to be=20 automatically loaded after a restart: =09 cd driver =09 make installboot (as root) =09 Note: If error messages are displayed or if the installation aborts,=20 check that your system meets with the system requirements. =20 =20 =2D------------------------------------------------------------------------= =2D------ =09 4. dLAN duo The dLAN duo can be connected either via Ethernet or USB ports. If both are installed, USB has priority. After you install the USB driver from devolo, your computer will=20 recognise all connected dLAN duo adapters as network=20 interfaces. This means that a dLAN duo can be treated like=20 any other interface, such as an Ethernet port, for example. Entering the command 'ifconfig -a' displays all network interfaces.=20 Each dLAN duo adapter has an identifier that consists of=20 'dlanusb' and a unique number (e.g. "0" for the first device, "1" = for=20 the second, etc.). Note: The command 'ifconfig -a' can only be executed as "root". =20 4.1 Configuration - one-time application=20 (e.g. to test the installation) Note: All of the IP addresses named here are examples only. After listing all of the network interfaces with the command=20 'ifconfig -a', continue with the configuration with the following=20 example entries:=20 ifconfig dlanusb0 198.168.0.1 netmask 255.255.255.0 up=20 =09 Note: Make sure that the new IP addresses are not already being used in your network and that they lie within your existing range of IP addresses!=20 4.2 Configuration under SUSE Linux =97 permanent installation=09 Note: This procedure can only be executed as "root".=20 For the permanent installation of the dLAN duo under SUSE=20 Linux, you should create a text file with the necessary information for=20 the adapter.=20 Enter the following information with any text editor (e.g. edit, pico): - if IP addresses are to be assigned dynamically:=20 BOOTPROTO=3D'dhcp' =20 STARTMODE=3D'hotplug' =09 Finally, the file is saved under the unique identifier for the=20 dLAN duo adapter as follows: /etc/sysconfig/network/ifcfg-dlanusb0 =20 =20 =09 - if IP addresses are to be assigned statically: BOOTPROTO=3D'static' STARTMODE=3D'hotplug' IPADDR=3D'192.168.0.1' NETMASK=3D'255.255.255.0' Note: Make sure that the new IP addresses are not already being used in your network and that they lie within your existing range of IP addresses! =20 =09 Finally, the file is saved under the unique identifier for the=20 dLAN duo adapter as follows: =09 /etc/sysconfig/network/ifcfg-dlanusb0 =20 To define a gateway, create the file /etc/sysconfig/network/ifroute-dlanusb0=20 and enter the following information: default 192.168.0.253 - - =20 =20 =09 Note: Make sure that the IP address is the same as that for your=20 gateway. In most cases the network router is the gateway. =09 To set the DNS server edit the file /etc/resolv.conf as follows: =09 nameserver 192.168.0.253=20 (IP address corresponds to that of the DNS server) Note: Ensure that the IP address corresponds to that of your DNS server. In most cases the network router is the DNS server. =09 Note: dLAN duo adapters cannot be configured graphically with Yast.=20 =20 4.3 Configuration under Debian Linux =97 permanent installation=09 Note: This procedure can only be executed as "root". =20 Under Debian Linux, the following information is appended to the file '/etc/interfaces': - if IP addresses are to be assigned dynamically:=20 auto dlanusb0 =09 iface dlanusb0 inet dhcp - if IP addresses are to be assigned statically: auto dlanusb0=09 iface dlanusb0 inet static address 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.253 (only required for Internet access) =09 The file '/etc/resolv.conf' must be edited to ensure that the name resolution is executed correctly. Enter the IP address for the DNS server into this file, e.g. nameserver 192.168.0.253 (only required for Internet access) Note: Ensure that the IP address corresponds to that of your DNS server. In most cases the network router is the DNS server. =09 =09 Note: Operating multiple network interfaces can potentially cause problems with DNS and routing. We recommend the use of DHCP for the assignment of IP addresses so that the DNS and gateway are adapted automatically. =2D------------------------------------------------------------------------= =2D------ 5. dlanconfig =20 Note: The following procedure can only be executed as "root".=20 Entering 'dlanconfig' allows you to configure a HomePlug network. The following entry is an example that adds your first local dLAN adapt= er (dlanusb0) to your network: =09 /usr/local/sbin/dlanconfig dlanusb0 Note: If a local dLAN adapter is connected via Ethernet, then dlanconfig will be started with the identifier of the appropriate network card, i.e. if it is connected to the first network card,=20 then the entry is as follows: /usr/local/sbin/dlanconfig eth0 =09 A menu assists you to set the network password for the local and/or remote dLAN devices. You also have an overview of all dLAN devices installed in your network. =20 5.1 Change password You can change the HomePlug password for the local dLAN adapter in the menu by selecting the option 'Set local network password' and enter= ing the new network password. You will then see a brief confirmation if= the password was changed without error. =09 You can change the HomePlug password for a remote dLAN adapter in the menu by selecting the option 'Set remote network password'. Enter t= he new network password and the Security ID of the remote dLAN adapter= =2E The Security ID is printed on the back of every dLAN adapter. Please ob= serve that entering the Security ID (XXXX-XXXX-XXXX-XXXX) is case sensiti= ve. You will then see a brief confirmation if the password was changed without error. 5.2 Overview of the dLAN network For an overview of all of the remote dLAN adapters installed in your dLAN network, use the menu to access the option 'List remote device= s'. dlanconfig also displays the connection rates between the local and= the remote dLAN devices. If a remote dLAN adapter is highlighted with the * symbol, then the connection rate value has not been updated. =2D------------------------------------------------------------------------= =2D------ --Boundary-01=_Uj8fG2971phPZwc Content-Type: text/x-csrc; charset="us-ascii"; name="devolo_usb.c" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="devolo_usb.c" /*=20 devolo_usb.c: dLAN USB driver for linux.=20 Only for use with dLAN adaptors from devolo. Copyright 2006 devolo AG */ =20 /* * Include */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "devolo_usb.h" static int multicast_filter_limit =3D 32; /* * List of supported vendor_id/device_id */ static struct usb_device_id plUsb_ids[] =3D { { USB_DEVICE (USB_INTELLON_VENDOR_ID, USB_INTELLON_PRODUCT_ID), }, {}, =20 }; #if defined(MODULE_LICENSE) MODULE_LICENSE ("devolo AG"); #endif MODULE_AUTHOR (DRIVER_AUTHOR); MODULE_DESCRIPTION (DRIVER_DESC); MODULE_DEVICE_TABLE (usb, plUsb_ids); static void ctrl_callback (struct urb * urb) { devoloUSB_t *devolo =3D urb->context; if (!devolo) return; switch (urb->status) { case 0: break; case -EINPROGRESS: return; case -ENOENT: break; default: warn("%s: status %d",__FUNCTION__, urb->status); } wake_up (&devolo->ctrl_wait); } /* * Function that send packet to upper level */ #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) static void devolo_read_bulk_callback (struct urb *urb, struct pt_regs * un= used) #else static void devolo_read_bulk_callback (struct urb *urb) #endif { devoloUSB_t *devolo =3D urb->context; struct net_device *net; int count =3D urb->actual_length; int res; struct sk_buff *skb; =20 =20 if (!devolo || !(devolo->flags & DEVOLO_RUNNING)) return; =20 net =3D devolo->net; if (!netif_device_present (net)) return; if (devolo->flags & DEVOLO_RX_BUSY){ /* * Update stats */ devolo->stats.rx_errors++; return; } devolo->flags |=3D DEVOLO_RX_BUSY; =20 switch (urb->status){ case 0: break; case -ETIMEDOUT: devolo->flags &=3D ~DEVOLO_RX_BUSY; break; case -EPIPE: /* stall or disconnect */ warn("%s: no rx stall recovery", net->name); return; case -ENOENT: case -ECONNRESET: case -ESHUTDOWN: return; default: goto goon; } =20 if (!count) goto goon; if (!(skb =3D dev_alloc_skb (count))) goto goon; skb->dev =3D net; eth_copy_and_sum (skb, devolo->rx_buff, count, 0); /* bug 1180*/ skb_put (skb, count-2); skb->protocol =3D eth_type_trans (skb, net); /* * Sending packet to upper level */ netif_rx (skb); /* * Update stats */ devolo->stats.rx_packets++; devolo->stats.rx_bytes +=3D count; goon: FILL_BULK_URB (devolo->rx_urb, devolo->usb, usb_rcvbulkpipe (devolo->usb, 1), devolo->rx_buff, DEVOLO_MAX_MTU, devolo_read_bulk_callback, devolo); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) if ((res =3D usb_submit_urb (devolo->rx_urb,GFP_ATOMIC))) #else if ((res =3D usb_submit_urb (devolo->rx_urb))) #endif printk(KERN_ERR "Failed submit rx_urb %d\n", res); devolo->flags &=3D ~DEVOLO_RX_BUSY; return; } /* * Callback called after packet transmission */=20 static void=20 #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) devolo_write_bulk_callback (struct urb *urb,struct pt_regs * unused) #else devolo_write_bulk_callback (struct urb *urb) #endif { devoloUSB_t *devolo =3D urb->context; if (!devolo || !(devolo->flags & DEVOLO_RUNNING)) return; if (!netif_device_present (devolo->net)) return; devolo->net->trans_start =3D jiffies; /* * Restart packet queue */ netif_wake_queue (devolo->net); } /* * Timeout function */ static void devolo_tx_timeout (struct net_device *net) { devoloUSB_t * devolo =3D net->priv; if (!devolo) return; #if ((LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE= <=3D KERNEL_VERSION(2,6,14))) devolo->tx_urb->transfer_flags |=3D URB_ASYNC_UNLINK; #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) devolo->tx_urb->transfer_flags |=3D USB_ASYNC_UNLINK; #endif usb_unlink_urb (devolo->tx_urb); /* * Update stats */ devolo->stats.tx_errors++; } /* * Function called when kernel need to transmit a packet */ static int devolo_start_xmit (struct sk_buff *skb, struct net_device *net) { devoloUSB_t *devolo =3D net->priv; int count =3D skb->len+2; int res; __u16 l16 =3D skb->len; if (!(count % 64)){ count++; l16++; } if (count < 64){ count=3D65; l16=3D63; } /* * Stop packet queue */ netif_stop_queue (net); ((unsigned char *) devolo->tx_buff)[0] =3D l16 & 0xFF; ((unsigned char *) devolo->tx_buff)[1] =3D (l16 & 0x700) >> 8; memcpy (devolo->tx_buff+2, skb->data, skb->len); =20 FILL_BULK_URB (devolo->tx_urb, devolo->usb, usb_sndbulkpipe (devolo->usb, 2), devolo->tx_buff, count, devolo_write_bulk_callback, devolo); /* * Submit urb and update stats */ #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) if ((res =3D usb_submit_urb (devolo->tx_urb,GFP_ATOMIC))){ #else if ((res =3D usb_submit_urb (devolo->tx_urb))){ #endif warn("failed tx_urb %d",res); switch (res){ case -EPIPE: /* stall or disconnect... cleanup should=20 already have been scheduled */ break; case -ENODEV: /* disconnect() upcoming */ break; default: devolo->stats.tx_errors++; netif_start_queue (net); } }else{ devolo->stats.tx_packets++; devolo->stats.tx_bytes +=3D skb->len; net->trans_start =3D jiffies; } dev_kfree_skb (skb); return 0; } /* * Function that manage stats of the device */ static struct net_device_stats * devolo_netdev_stats (struct net_device *dev) { return &((devoloUSB_t *) dev->priv)->stats; } /* * Function that convert hex value to decimal value */ static inline unsigned char hex2dec( unsigned char digit ) { if ( (digit >=3D '0') && (digit <=3D '9') )=09 return (digit - '0'); =20 if ( (digit >=3D 'a') && (digit <=3D 'f') )=09 return (digit - 'a' + 10); =20 if ( (digit >=3D 'A') && (digit <=3D 'F') )=09 return (digit - 'A' + 10); =20 return 16; } /* * Function that fill MAC address=20 */ static void set_ethernet_addr( devoloUSB_t *devolo) { int i; int len; unsigned char buffer[13]; unsigned char mac_addr[6]; len =3D usb_string(devolo->usb, 3, buffer, 13); =09 if (len !=3D 12) { printk(KERN_ERR "Attempting to get MAC address returned %d bytes\n", le= n); return; } =09 /*=20 * Fill in the mac_addr=20 */ for (i =3D 0; i < 6; i++){ mac_addr[i] =3D ( hex2dec( buffer[2 * i] ) << 4 ) + hex2dec( buffer[2 *= i + 1] ); } =09 /*=20 * Now copy into the kernel's network driver.=20 */ memcpy(devolo->net->dev_addr, mac_addr, SIZEOF_MAC); } /* * Open function called every time you plug a device */=20 static int devolo_open (struct net_device *net) { devoloUSB_t *devolo =3D (devoloUSB_t *) net->priv; int res; // set_ethernet_addr(devolo); devolo->flags &=3D ~DEVOLO_RX_BUSY; FILL_BULK_URB (devolo->rx_urb, devolo->usb, usb_rcvbulkpipe (devolo->usb, 1), devolo->rx_buff, DEVOLO_MAX_MTU, devolo_read_bulk_callback,devolo);=20 #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) if ((res =3D usb_submit_urb (devolo->rx_urb,GFP_KERNEL/*GFP_ATOMIC??*/))) #else if ((res =3D usb_submit_urb (devolo->rx_urb))) #endif { printk(KERN_ERR "Failed rx_urb %d\n", res); } netif_start_queue (net); devolo->flags |=3D DEVOLO_RUNNING; return 0; } /* * Close function called every time you unplug a device */ static int=20 devolo_close (struct net_device *net) { devoloUSB_t * devolo =3D net->priv; devolo->flags &=3D ~DEVOLO_RUNNING; netif_stop_queue (net); usb_unlink_urb (devolo->rx_urb); usb_unlink_urb (devolo->tx_urb); usb_unlink_urb (devolo->ctrl_urb); return 0; } /* * Manager for ethernet ioctl */ static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) { u32 ethcmd; if (copy_from_user (ðcmd, useraddr, sizeof (ethcmd))) return -EFAULT; switch (ethcmd) { case ETHTOOL_GDRVINFO: { struct ethtool_drvinfo info =3D { ETHTOOL_GDRVINFO }; strncpy (info.driver, "devolo", sizeof (info.driver) - 1); if (copy_to_user (useraddr, &info, sizeof (info))) return -EFAULT; return 0; } } return -EOPNOTSUPP; } static int read_mii_word( devoloUSB_t *devolo, __u8 phy, __u8 indx, __u16 *= regd ){ return 0; } static int write_mii_word( devoloUSB_t *devolo, __u8 phy, __u8 indx, __u16 = regd ){ return 0; } /* * Function that manage standard ioctl system calls */ static int devolo_ioctl (struct net_device *net, struct ifreq *rq, int cmd) { __u16 *data =3D (__u16 *) & rq->ifr_data; devoloUSB_t *devolo =3D net->priv; switch (cmd) { case SIOCETHTOOL: return netdev_ethtool_ioctl (net, (void *) rq->ifr_data); case SIOCDEVPRIVATE: data[0] =3D devolo->phy; case SIOCDEVPRIVATE + 1: read_mii_word (devolo, data[0], data[1] & 0x1f, &data[3]); return 0; case SIOCDEVPRIVATE + 2: if (!capable (CAP_NET_ADMIN)) return -EPERM; write_mii_word (devolo, devolo->phy, data[1] & 0x1f, data[2]); return 0; default: return -EOPNOTSUPP; } } /* * Function for multicast set */=20 static void devolo_set_multicast (struct net_device *net) { devoloUSB_t *devolo =3D net->priv; /* * Stop packet queue */ netif_stop_queue (net); if (net->flags & IFF_PROMISC) printk(KERN_INFO "%s: Promiscuous mode enabled\n", net->name); =20 else if ((net->mc_count > multicast_filter_limit) || (net->flags & IFF_ALLMULTI)) printk(KERN_INFO "%s set allmulti\n", net->name); =20 devolo->flags |=3D ETH_REGS_CHANGE; ctrl_callback (devolo->ctrl_urb); /* * Restart packet queue */ netif_wake_queue (net); =20 } /* * Function that allocate, initialize * and register a new device */ #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) static int=20 devolo_probe (struct usb_interface* intf, const struct usb_device_id *id) { struct usb_device *dev=3Dinterface_to_usbdev(intf); #else=20 static void * devolo_probe (struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id) { #endif struct net_device *net; devoloUSB_t *devolo; int dev_index =3D 0; int err; =20 #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) if (usb_reset_configuration (dev)) #else if (usb_set_configuration (dev, dev->config[0].bConfigurationValue)) #endif { printk(KERN_ERR "usb_set_configuration failed\n"); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) return -ENODEV; #else return NULL; #endif } if (!(devolo =3D kmalloc (sizeof (struct devoloUSB), GFP_KERNEL))) { printk(KERN_ERR "Out of memory allocating device structure\n"); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) return -ENOMEM; #else return NULL; #endif } #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) usb_get_dev(dev); #else usb_inc_dev_use (dev); #endif memset (devolo, 0, sizeof (struct devoloUSB)); devolo->dev_index =3D dev_index; init_waitqueue_head (&devolo->ctrl_wait); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) devolo->ctrl_urb=3Dusb_alloc_urb(0,GFP_KERNEL); if(!devolo->ctrl_urb) return -ENOMEM; devolo->rx_urb=3Dusb_alloc_urb(0,GFP_KERNEL); if(!devolo->rx_urb) { usb_free_urb(devolo->ctrl_urb); return -ENOMEM; } devolo->tx_urb=3Dusb_alloc_urb(0,GFP_KERNEL); if(!devolo->tx_urb) { usb_free_urb(devolo->ctrl_urb); usb_free_urb(devolo->rx_urb); return -ENOMEM; } devolo->intr_urb=3Dusb_alloc_urb(0,GFP_KERNEL); if(!devolo->intr_urb) { usb_free_urb(devolo->ctrl_urb); usb_free_urb(devolo->rx_urb); usb_free_urb(devolo->tx_urb); return -ENOMEM; } #else devolo->ctrl_urb=3Dusb_alloc_urb(0); devolo->rx_urb=3Dusb_alloc_urb(0); devolo->tx_urb=3Dusb_alloc_urb(0); devolo->intr_urb=3Dusb_alloc_urb(0); #endif /* * Allocate a device */ net =3D alloc_etherdev(NET_SIZE_OF_PRIV); if(net=3D=3DNULL) { usb_free_urb(devolo->ctrl_urb); usb_free_urb(devolo->rx_urb); usb_free_urb(devolo->tx_urb); usb_free_urb(devolo->intr_urb); kfree (devolo); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) return -ENOMEM; #else return NULL; #endif } /* * Allocate a name */ strcpy(net->name, DEVICE_NAME_MASK); if (dev_alloc_name(net, DEVICE_NAME_MASK)<0) { usb_free_urb(devolo->ctrl_urb); usb_free_urb(devolo->rx_urb); usb_free_urb(devolo->tx_urb); usb_free_urb(devolo->intr_urb); kfree(net); kfree (devolo); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) return -ENOMEM; #else return NULL; #endif } #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) init_etherdev (net, NET_SIZE_OF_PRIV); #endif /* * Register the device */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) rtnl_lock(); err =3D register_netdevice(net); rtnl_unlock(); if (err < 0) { usb_free_urb(devolo->ctrl_urb); usb_free_urb(devolo->rx_urb); usb_free_urb(devolo->tx_urb); usb_free_urb(devolo->intr_urb); kfree(net); kfree(devolo); net =3D NULL; return NULL; } #endif /* * Implement operations needed by the device */ ether_setup (net); devolo->usb =3D dev; devolo->net =3D net; SET_MODULE_OWNER (net); net->priv =3D devolo; net->open =3D devolo_open; net->stop =3D devolo_close; net->watchdog_timeo =3D DEVOLO_TX_TIMEOUT; net->tx_timeout =3D devolo_tx_timeout; net->do_ioctl =3D devolo_ioctl; net->hard_start_xmit =3D devolo_start_xmit; net->set_multicast_list =3D devolo_set_multicast; net->get_stats =3D devolo_netdev_stats; net->mtu =3D DEVOLO_MTU; devolo->phy =3D 1; set_ethernet_addr(devolo); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) usb_set_intfdata(intf, devolo); SET_NETDEV_DEV(net, &intf->dev); rtnl_lock(); err =3D register_netdevice(net); rtnl_unlock(); return 0; #else return devolo; #endif } /* * Function that free all allocated resource */ static void #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) devolo_disconnect (struct usb_interface* intf){ struct devoloUSB *devoloUSB =3D usb_get_intfdata(intf); struct usb_device *dev=3Dinterface_to_usbdev(intf); #else devolo_disconnect (struct usb_device *dev, void *ptr){ struct devoloUSB *devoloUSB =3D ptr; #endif if (!devoloUSB) { printk(KERN_ERR "Unregistering non-existant device\n"); return; } devoloUSB->flags |=3D DEVOLO_UNPLUG; unregister_netdev (devoloUSB->net); #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) usb_put_dev(dev); #else usb_dec_dev_use (dev); #endif usb_free_urb(devoloUSB->rx_urb); usb_free_urb(devoloUSB->tx_urb); usb_free_urb(devoloUSB->intr_urb); usb_free_urb(devoloUSB->ctrl_urb); kfree (devoloUSB->net); kfree (devoloUSB); devoloUSB =3D NULL; } /* * Structure needed to register our objects * and find our hardware device */ static struct usb_driver devolo_driver =3D { name:"devolo", probe:devolo_probe, disconnect:devolo_disconnect, id_table:plUsb_ids, }; int __init devolo_init (void) { printk (KERN_INFO DRIVER_DESC ":" DRIVER_VERSION "\n"); /* char usbmgr[9]=3D{0}; */ #ifdef USBMGR #if (LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,0)) #define usbmgr USBMGR"_hcd" /* sprintf(usbmgr,"%s_hcd",USBMGR); */ #else #define usbmgr "usb-"USBMGR /* sprintf(usbmgr,"usb-%s",USBMGR); */ =20 #endif request_module(usbmgr); #endif return usb_register (&devolo_driver); } void __exit devolo_exit (void) { usb_deregister (&devolo_driver); } module_init (devolo_init); module_exit (devolo_exit); --Boundary-01=_Uj8fG2971phPZwc Content-Type: text/plain; charset="us-ascii"; name="make_1.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="make_1.txt" making all in tool make[1]: Entering directory `/home/dsl/dLAN-linux-package-v3/tool' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/home/dsl/dLAN-linux-package-v3/tool' making all in driver make[1]: Entering directory `/home/dsl/dLAN-linux-package-v3/driver' ./kerneldir.sh /lib/modules/2.6.21-gentoo-r3/build make[2]: Entering directory `/usr/src/linux-2.6.21-gentoo-r3' CC [M] /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.o /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.c:22:26: error: linux/config.h: No such file or directory /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.c: In function 'devolo_read_bulk_callback': /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.c:153: warning: passing argument 6 of 'usb_fill_bulk_urb' from incompatible pointer type /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.c: In function 'devolo_start_xmit': /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.c:249: warning: passing argument 6 of 'usb_fill_bulk_urb' from incompatible pointer type /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.c: In function 'devolo_open': /home/dsl/dLAN-linux-package-v3/driver/devolo_usb.c:358: warning: passing argument 6 of 'usb_fill_bulk_urb' from incompatible pointer type make[3]: *** [/home/dsl/dLAN-linux-package-v3/driver/devolo_usb.o] Error 1 make[2]: *** [_module_/home/dsl/dLAN-linux-package-v3/driver] Error 2 make[2]: Leaving directory `/usr/src/linux-2.6.21-gentoo-r3' make[1]: *** [default] Error 2 make[1]: Leaving directory `/home/dsl/dLAN-linux-package-v3/driver' make: *** [all] Error 2 --Boundary-01=_Uj8fG2971phPZwc-- --nextPart1373337.UXWQFXpfWL Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGf8jUCBEaaFO6I+ARAqCOAJoC/IUL8FfexlO53xX2xoayHsqD5wCdEuo6 7+cb+vrKYJj2X1mYVTZ75FY= =ZoTR -----END PGP SIGNATURE----- --nextPart1373337.UXWQFXpfWL-- -- gentoo-user@gentoo.org mailing list