* (unknown),
@ 2013-05-07 12:12 kedari appana
2013-05-07 12:28 ` iproute2 and libsocketcan Marc Kleine-Budde
0 siblings, 1 reply; 20+ messages in thread
From: kedari appana @ 2013-05-07 12:12 UTC (permalink / raw)
To: linux-can@vger.kernel.org
Hi
I compiled can utilities and
> > iproute2 and libsocketcan utilities.But when i try to use any one of
> > the below commands i am getting below errors.
> > ip link set can0 type can bitrate 50000 triple-sampling on
> > ip: either "dev" is duplicate, or "type" is garbage
> > canconfig can0 bitrate 50000 ctrlmode triple-sampling on
> > -sh: canconfig: not found
> > Please explain me how to compile the socketcan am i need to copy these
> > can utilities into linux-source tree in order work.Please explain
> > I am new to linux that's why i am asking everything sorry for making
> > inconvenience to you.
> >
> > Regards,
> > Kedar.
> >
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown)
@ 2020-06-27 21:52 helen
0 siblings, 0 replies; 20+ messages in thread
From: helen @ 2020-06-27 21:52 UTC (permalink / raw)
To: ebkrumme
MONEY-GRAM TRANSFERRED PAYMENT INFO:
Below is the sender’s information
1. MG. REFERENCE NO#: 36360857
2. SENDER'S NAME: Johnson Williams
3. AMOUNT TO PICKUP: US$10,000
Go to any Money Gram office near you and pick up the payment Track the
Reference Number by visiting and click the link below
(https://secure.moneygram.com/embed/track) and enter the Reference
Number: 36360857 and the Last Name: Williams, you will find the payment
available for pickup instantly.
Yours Sincerely,
Mrs. Helen Marvis
United Nations Liaison Office
Directorate for International Payments
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown)
@ 2020-05-08 22:58 Barbara D Wilkins
0 siblings, 0 replies; 20+ messages in thread
From: Barbara D Wilkins @ 2020-05-08 22:58 UTC (permalink / raw)
Hallo, Wir sind eine christliche Organisation, die gegründet wurde, um Menschen zu helfen, die Hilfe benötigen, beispielsweise finanzielle Hilfe. Wenn Sie also finanzielle Schwierigkeiten haben oder sich in einem finanziellen Chaos befinden und Geld benötigen, um Ihr eigenes Unternehmen zu gründen, oder wenn Sie einen Kredit benötigen Begleichen Sie Ihre Schulden oder zahlen Sie Ihre Rechnungen ab, gründen Sie ein gutes Geschäft oder es fällt Ihnen schwer, einen Kapitalkredit von lokalen Banken zu erhalten. Kontaktieren Sie uns noch heute per E-Mail: Lassen Sie sich diese Gelegenheit also nicht entgehen weil Jesus gestern, heute und für immer derselbe ist. Bitte, diese sind für ernsthafte und gottesfürchtige Menschen.Dein Name:Darlehensbetrag:Leihdauer:Gülti
ge Handynummer:Vielen Dank für Ihr Verständnis für Ihren Kontakt, während wir warten: mrsbarbarawilkinsfunds.usagmail.comGrüßeVerwaltung
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown)
@ 2020-03-09 7:34 Michael J. Weirsky
0 siblings, 0 replies; 20+ messages in thread
From: Michael J. Weirsky @ 2020-03-09 7:34 UTC (permalink / raw)
--
My name is Michael J. Weirsky, I'm an unemployed Handy man , winner of
$273million Jackpot in March 8, 2019. I donate $1.000.000,00 to you.
Contact me via email: micjsky@aol.com for info / claim.
Continue reading:
https://abcnews.go.com/WNT/video/jersey-handyman-forward-273m-lottery-winner-61544244
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown)
@ 2020-03-05 10:46 Juanito S. Galang
0 siblings, 0 replies; 20+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:46 UTC (permalink / raw)
Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7@gmail.com ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7@gmail.comFreundliche Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown)
@ 2020-03-05 0:26 Maria Alessandra Filippi
0 siblings, 0 replies; 20+ messages in thread
From: Maria Alessandra Filippi @ 2020-03-05 0:26 UTC (permalink / raw)
Hallo,
Ich bin Frau Maria Elisabeth Schaeffler, eine deutsche Wirtschaftsmagnatin, Investorin und Philanthropin. Ich bin der Vorsitzende von Wipro Limited. Ich habe 25 Prozent meines persönlichen Vermögens für wohltätige Zwecke ausgegeben. Und ich habe auch versprochen, den Rest von 25% in diesem Jahr 2020 an Einzelpersonen zu verschenken. Ich habe beschlossen, 1.000.000,00 Euro an Sie zu spenden. Wenn Sie an meiner Spende interessiert sind, kontaktieren Sie mich für weitere Informationen.
Sie können auch mehr über mich über den Link unten lesen
https://en.wikipedia.org/wiki/Maria-Elisabeth_Schaeffler
Herzlicher Gruss
Geschäftsführer Wipro Limited
Maria-Elisabeth_Schaeffler
E-Mail: mrsmariaelisabethschaeffler11@gmail.com
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2017-12-01 14:22 Rein Appeldoorn
0 siblings, 0 replies; 20+ messages in thread
From: Rein Appeldoorn @ 2017-12-01 14:22 UTC (permalink / raw)
To: linux-can
unsubscribe linux-can
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2017-09-01 19:52 sunaina
0 siblings, 0 replies; 20+ messages in thread
From: sunaina @ 2017-09-01 19:52 UTC (permalink / raw)
To: linux-can
[-- Attachment #1: 73711.doc --]
[-- Type: application/msword, Size: 40147 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2017-03-02 14:44 Casperina Litaay
0 siblings, 0 replies; 20+ messages in thread
From: Casperina Litaay @ 2017-03-02 14:44 UTC (permalink / raw)
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2016-09-17 8:07 makafe david
0 siblings, 0 replies; 20+ messages in thread
From: makafe david @ 2016-09-17 8:07 UTC (permalink / raw)
Hello!
I have something I wanna share with you. Kindly reply back if interested.
Thank you!!
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2016-01-20 10:23 Marc Kleine-Budde
0 siblings, 0 replies; 20+ messages in thread
From: Marc Kleine-Budde @ 2016-01-20 10:23 UTC (permalink / raw)
To: linux-can; +Cc: netdev
This is Damien Riegel's series with minor changes.
regards,
Marc
---
This patchset introduces support for the technologic version of the
SJA1000. Access to IP's registers are proxied through a window,
requiring two bus accesses to read or write a register. These accesses
must be protected by a spinlock to prevent race conditions. Currently,
there is no easy way to allocate and initialize this spinlock.
SJA1000 already provides a way to allocate private data, but
sja1000_platform.c makes no use of it.
Patch 1 adds the capability to allocate and initialize private data on a
per-compatible basis in sja1000_platform.c.
Patch 2 updates device tree documentation to add the technologic
version.
Patch 3 updates the driver to implement the technologic version
Changes in v5:
- remove empty "static struct sja1000_of_data nxp_data", again
- add additional check for of_id->data
Changes in v4:
- add sp_ prefix to technologic functions
- add empty "static struct sja1000_of_data nxp_data"
- make "struct sja1000_of_data technologic_data" static
- get rid of "?" operator in sp_probe()
Changes in v3:
- moved sp_of_table above sp_probe as it is used in this function
- removed functions added in v2 and do everyting in sp_probe
Changes in v2:
- added a patch to allocate and initialize private data
- changed device tree documentation
- added a spinlock to protect bus accesses
- changed sp_{read,write}_reg16 to io{read,write}16
^ permalink raw reply [flat|nested] 20+ messages in thread* (unknown),
@ 2016-01-14 3:01 Global Financial Service
0 siblings, 0 replies; 20+ messages in thread
From: Global Financial Service @ 2016-01-14 3:01 UTC (permalink / raw)
Apply for a loan at 3% reply to this Email for more Info
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2015-12-18 2:32 Financial Service
0 siblings, 0 replies; 20+ messages in thread
From: Financial Service @ 2015-12-18 2:32 UTC (permalink / raw)
To: Recipients
Are you in need of private or business loans for various purposes? if yes,apply now
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2015-12-08 16:13 Loan, Service, <hardiyansyah@mail.binadarma.ac.id>
0 siblings, 0 replies; 20+ messages in thread
From: Loan, Service, <hardiyansyah@mail.binadarma.ac.id> @ 2015-12-08 16:13 UTC (permalink / raw)
To: Recipients
Are you in need of private or business loans for various purposes? if yes,apply now
^ permalink raw reply [flat|nested] 20+ messages in thread
* (unknown),
@ 2015-09-15 20:17 Mathieu Erbs
0 siblings, 0 replies; 20+ messages in thread
From: Mathieu Erbs @ 2015-09-15 20:17 UTC (permalink / raw)
Good day
Strictly Confidential gives me a great deal of pleasure to write you
this mail and even when it might come to you as a surprise
I got your contact through Online Directory, I decided to contact you
for this great mutual benefit
My name is Mister Mathieu Erbs, the division manager of the Bank
TSB, am contacting you through this means in order for you to assist
me and receive the value of 8 million dollars left by a client of
mine , a Contractor who died in a fatal accident on April 2012
The bank has given me two months to provide a beneficiary of my
client before the mandate, otherwise the account will be confiscated
I hereby seek your attention to Stand as a beneficiary to receive this
amount to your account
kindly reply for more details and your percentage through this email
mathieuerbs@gmail.com
Please do write back to me at your earliest convenience as your
opinion is of extremely high value to me and will be extremely helpful
to me.
Best Regards, Mr. Mathieu
UK
^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <1570038211.167595.1414613146892.JavaMail.yahoo@jws10056.mail.ne1.yahoo.com>]
* (unknown),
@ 2013-10-02 19:45 Max S.
0 siblings, 0 replies; 20+ messages in thread
From: Max S. @ 2013-10-02 19:45 UTC (permalink / raw)
To: linux-can
[-- Attachment #1: Type: text/plain, Size: 252 bytes --]
Hello All,
Whats the protocol for getting a driver into the mainline kernel?
I've reached a working and fairly stable state with the CAN adapter I'm
working on, and would like to get its driver mainlined.
Attached is a patch.
Thanks,
Max Schneider.
[-- Attachment #2: 0001-GS_USB-CAN-Driver.patch --]
[-- Type: text/x-patch, Size: 28070 bytes --]
From 2e4c4df9aae119279eb0913db0b7bc1d1025879a Mon Sep 17 00:00:00 2001
From: Maximilian Schneider <max@schneidersoft.net>
Date: Wed, 2 Oct 2013 18:48:26 +0000
Subject: [PATCH] GS_USB CAN Driver.
Signed-off-by: Maximilian Schneider <max@schneidersoft.net>
---
drivers/net/can/usb/Kconfig | 8 +
drivers/net/can/usb/Makefile | 1 +
drivers/net/can/usb/gs_usb.c | 1121 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 1130 insertions(+)
create mode 100644 drivers/net/can/usb/gs_usb.c
diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig
index fc96a3d..f5e3e8c 100644
--- a/drivers/net/can/usb/Kconfig
+++ b/drivers/net/can/usb/Kconfig
@@ -54,4 +54,12 @@ config CAN_8DEV_USB
This driver supports the USB2CAN interface
from 8 devices (http://www.8devices.com).
+config CAN_GS_USB
+ tristate "Geschwister Schneider UG interfaces"
+ ---help---
+ This driver supports the Geschwister Schneider USB/CAN devices.
+ If unsure choose N,
+ choose Y for built in support,
+ M to compile as module (module will be named: gs_usb).
+
endmenu
diff --git a/drivers/net/can/usb/Makefile b/drivers/net/can/usb/Makefile
index becef46..c21a521 100644
--- a/drivers/net/can/usb/Makefile
+++ b/drivers/net/can/usb/Makefile
@@ -7,5 +7,6 @@ obj-$(CONFIG_CAN_ESD_USB2) += esd_usb2.o
obj-$(CONFIG_CAN_KVASER_USB) += kvaser_usb.o
obj-$(CONFIG_CAN_PEAK_USB) += peak_usb/
obj-$(CONFIG_CAN_8DEV_USB) += usb_8dev.o
+obj-$(CONFIG_CAN_GS_USB) += gs_usb.o
ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
new file mode 100644
index 0000000..558fc23
--- /dev/null
+++ b/drivers/net/can/usb/gs_usb.c
@@ -0,0 +1,1121 @@
+/* CAN driver for Geschwister Schneider USB/CAN devices.
+ *
+ * Copyright (C) 2013 Geschwister Schneider Technologie-,
+ * Entwicklungs- und Vertriebs UG (Haftungsbeschränkt).
+ *
+ * Many thanks to all socketcan devs!
+ *
+ * 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 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/signal.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/usb.h>
+
+#include <linux/can.h>
+#include <linux/can/dev.h>
+#include <linux/can/error.h>
+
+/* Device specific constants */
+#define USB_GSUSB_1_VENDOR_ID 0x1d50
+#define USB_GSUSB_1_PRODUCT_ID 0x606f
+
+#define GSUSB_ENDPOINT_IN 1
+#define GSUSB_ENDPOINT_OUT 2
+
+/* Device specific constants */
+enum gs_usb_breq {
+ GS_USB_BREQ_HOST_FORMAT = 0,
+ GS_USB_BREQ_BITTIMING,
+ GS_USB_BREQ_MODE,
+ GS_USB_BREQ_BERR,
+ GS_USB_BREQ_BT_CONST,
+ GS_USB_BREQ_DEVICE_CONFIG
+};
+
+enum gs_can_mode {
+ GS_CAN_MODE_RESET = 0,
+ GS_CAN_MODE_START
+};
+
+enum gs_can_state {
+ GS_CAN_STATE_ERROR_ACTIVE = 0,
+ GS_CAN_STATE_ERROR_WARNING,
+ GS_CAN_STATE_ERROR_PASSIVE,
+ GS_CAN_STATE_BUS_OFF,
+ GS_CAN_STATE_STOPPED,
+ GS_CAN_STATE_SLEEPING
+};
+
+/* data types passed between host and device */
+struct __packed gs_host_config {
+ u32 byte_order;
+};
+
+struct __packed gs_device_config {
+ u8 reserved1;
+ u8 reserved2;
+ u8 reserved3;
+ u8 icount;
+ u32 sw_version;
+ u32 hw_version;
+};
+
+#define GS_CAN_MODE_NORMAL 0
+#define GS_CAN_MODE_LISTEN_ONLY (1<<0)
+#define GS_CAN_MODE_LOOP_BACK (1<<1)
+#define GS_CAN_MODE_TRIPLE_SAMPLE (1<<2)
+#define GS_CAN_MODE_ONE_SHOT (1<<3)
+
+struct __packed gs_device_mode {
+ u32 mode;
+ u32 flags;
+};
+
+struct __packed gs_device_state {
+ u32 state;
+ u32 rxerr;
+ u32 txerr;
+};
+
+struct __packed gs_device_bittiming {
+ u32 prop_seg;
+ u32 phase_seg1;
+ u32 phase_seg2;
+ u32 sjw;
+ u32 brp;
+};
+
+#define GS_CAN_FEATURE_LISTEN_ONLY (1<<0)
+#define GS_CAN_FEATURE_LOOP_BACK (1<<1)
+#define GS_CAN_FEATURE_TRIPLE_SAMPLE (1<<2)
+#define GS_CAN_FEATURE_ONE_SHOT (1<<3)
+
+struct __packed gs_device_bt_const {
+ u32 feature;
+ u32 fclk_can;
+ u32 tseg1_min;
+ u32 tseg1_max;
+ u32 tseg2_min;
+ u32 tseg2_max;
+ u32 sjw_max;
+ u32 brp_min;
+ u32 brp_max;
+ u32 brp_inc;
+};
+
+#define GS_CAN_FLAG_OVERFLOW 1
+
+struct __packed gs_host_frame {
+ u32 echo_id;
+ u32 can_id;
+
+ u8 can_dlc;
+ u8 channel;
+ u8 flags;
+ u8 reserved;
+
+ u8 data[8];
+};
+
+#define GS_RX_BUFFER_SIZE sizeof(struct __packed gs_host_frame)
+
+/* Special address description flags for the CAN_ID */
+#define GS_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
+#define GS_RTR_FLAG 0x40000000U /* remote transmission request */
+#define GS_ERR_FLAG 0x20000000U /* error frame */
+
+/* Valid bits in CAN ID for frame formats */
+#define GS_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
+#define GS_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
+#define GS_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */
+
+/* FIXME: this macro is only a placeholder for a better function */
+#define CONVERT_FLAGS(x) x
+
+/* Only send a max of MAX_TX_URBS frames per channel to the device at a time. */
+#define MAX_TX_URBS 10
+/* Only launch a max of MAX_RX_URBS usb requests at a time. */
+#define MAX_RX_URBS 30
+/* Maximum number of interfaces the driver supports per device.
+ * Current hardware only supports 2 interfaces. The future may vary.
+ */
+#define MAX_INTF 2
+
+struct gs_tx_context {
+ struct gs_can *dev;
+ unsigned int echo_id;
+};
+
+struct gs_can {
+ struct can_priv can; /* must be the first member */
+
+ struct gs_usb *parent;
+
+ struct net_device *netdev;
+ struct usb_device *udev;
+ struct usb_interface *iface;
+
+ struct can_bittiming_const bt_const;
+ unsigned int channel; /* channel number */
+
+ spinlock_t tx_ctx_lock;
+ struct gs_tx_context tx_context[MAX_TX_URBS];
+
+ struct usb_anchor tx_submitted;
+ atomic_t active_tx_urbs;
+};
+
+/* usb interface struct */
+struct gs_usb {
+ struct gs_can *canch[MAX_INTF];
+
+ struct usb_anchor rx_submitted;
+
+ atomic_t active_channels;
+};
+
+/* 'allocate' a tx context.
+ * returns a valid tx context or NULL if there is no space.
+ */
+static struct gs_tx_context *gs_alloc_tx_context(struct gs_can *dev)
+{
+ int i = 0;
+ unsigned long flags;
+ spin_lock_irqsave(&dev->tx_ctx_lock, flags);
+
+ for (; i < MAX_TX_URBS; i++) {
+ if (dev->tx_context[i].echo_id == MAX_TX_URBS) {
+ dev->tx_context[i].echo_id = i;
+ spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
+ return &dev->tx_context[i];
+ }
+ }
+
+ spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
+ return NULL;
+}
+
+/* releases a tx context
+ */
+static void gs_free_tx_context(struct gs_tx_context *txc)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&txc->dev->tx_ctx_lock, flags);
+ txc->echo_id = MAX_TX_URBS;
+ spin_unlock_irqrestore(&txc->dev->tx_ctx_lock, flags);
+}
+
+/* Get a tx context by id.
+ */
+static struct gs_tx_context *gs_get_tx_context(
+ struct gs_can *dev,
+ unsigned int id)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&dev->tx_ctx_lock, flags);
+ if (id < MAX_TX_URBS) {
+ if (dev->tx_context[id].echo_id == id) {
+ spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
+ return &dev->tx_context[id];
+ }
+ }
+ spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
+ return NULL;
+}
+
+/* Get a tx contexts id.
+ */
+static unsigned int gs_tx_context_id(struct gs_tx_context *txc)
+{
+ unsigned int id;
+ unsigned long flags;
+ spin_lock_irqsave(&txc->dev->tx_ctx_lock, flags);
+ id = txc->echo_id;
+ spin_unlock_irqrestore(&txc->dev->tx_ctx_lock, flags);
+ return id;
+}
+
+#define BUFFER_SIZE sizeof(struct gs_host_frame)
+
+static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev)
+{
+ struct gs_device_mode *dm;
+ struct usb_interface *intf = gsdev->iface;
+ int rc;
+
+ dm = kzalloc(sizeof(*dm), GFP_KERNEL);
+ if (!dm)
+ return -ENOMEM;
+
+ dm->mode = GS_CAN_MODE_RESET;
+
+ rc = usb_control_msg(interface_to_usbdev(intf),
+ usb_sndctrlpipe(interface_to_usbdev(intf), 0),
+ GS_USB_BREQ_MODE,
+ USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ gsdev->channel,
+ 0,
+ dm,
+ sizeof(*dm),
+ 1000);
+
+ return rc;
+}
+
+/**************************** USB CALLBACKS **************************/
+static void gs_usb_recieve_bulk_callback(struct urb *urb)
+{
+ struct gs_usb *usbcan = urb->context;
+ struct gs_can *dev;
+ struct net_device *netdev;
+ int rc;
+ struct net_device_stats *stats;
+ struct gs_host_frame *hf = urb->transfer_buffer;
+ struct gs_tx_context *txc;
+
+ struct can_frame *cf;
+ struct sk_buff *skb;
+
+ BUG_ON(!usbcan);
+
+ switch (urb->status) {
+ case 0: /* success */
+ break;
+ case -ENOENT:
+ case -ESHUTDOWN:
+ return;
+ default:
+ /* printk(KERN_INFO "Rx URB aborted (%d)\n", urb->status); */
+ /* do not resubmit aborted urbs. eg: when device goes down */
+ return;
+ }
+
+ /* device reports out of range channel id */
+ if (hf->channel >= MAX_INTF)
+ /* printk(KERN_INFO "%d] strange channel #\n", hf->channel); */
+ goto resubmit_urb;
+
+ /* device reports bad channel id */
+ dev = usbcan->canch[hf->channel];
+ BUG_ON(!dev);
+
+ netdev = dev->netdev;
+ BUG_ON(!netdev);
+
+ if (!netif_device_present(netdev))
+ return;
+
+ stats = &dev->netdev->stats;
+
+ if (hf->echo_id == -1) { /* normal rx */
+ skb = alloc_can_skb(dev->netdev, &cf);
+ if (skb == NULL)
+ return;
+
+ cf->can_id = CONVERT_FLAGS(hf->can_id);
+ /* is it necessary to use get_can_dlc? */
+ cf->can_dlc = get_can_dlc(hf->can_dlc);
+ memcpy(cf->data, hf->data, 8);
+
+ netif_rx(skb);
+
+ netdev->stats.rx_packets++;
+ netdev->stats.rx_bytes += hf->can_dlc;
+ } else { /* echo_id = hf->echo_id */
+ if (hf->echo_id >= MAX_TX_URBS) {
+ netdev_info(netdev, "BAD echo %d\n", hf->echo_id);
+ goto resubmit_urb;
+ }
+
+ netdev->stats.tx_packets++;
+ netdev->stats.tx_bytes += hf->can_dlc;
+
+ txc = gs_get_tx_context(dev, hf->echo_id);
+
+ /* bad devices send bad echo_ids. */
+ if (!txc) {
+ netdev_info(netdev, "bad echo %d\n", hf->echo_id);
+ goto resubmit_urb;
+ }
+
+ can_get_echo_skb(netdev, gs_tx_context_id(txc));
+
+ gs_free_tx_context(txc);
+
+ netif_wake_queue(netdev);
+ }
+
+ if (hf->flags & GS_CAN_FLAG_OVERFLOW)
+ netdev_info(netdev, "overflow\n");
+
+
+resubmit_urb:
+ /* note: no urb refill... works for me */
+
+ rc = usb_submit_urb(urb, GFP_ATOMIC);
+
+ /* USB failure take down all interfaces */
+ if (rc == -ENODEV) {
+ for (rc = 0; rc < MAX_INTF; rc++) {
+ if (usbcan->canch[rc])
+ netif_device_detach(usbcan->canch[rc]->netdev);
+ }
+ }
+}
+
+static int gs_usb_set_bittiming(struct net_device *netdev)
+{
+ struct gs_can *dev = netdev_priv(netdev);
+ struct can_bittiming *bt = &dev->can.bittiming;
+ struct usb_interface *intf = dev->iface;
+ int rc;
+ struct gs_device_bittiming *dbt;
+
+ dbt = kmalloc(sizeof(*dbt), GFP_KERNEL);
+ if (!dbt)
+ return -ENOMEM;
+
+ dbt->prop_seg = bt->prop_seg;
+ dbt->phase_seg1 = bt->phase_seg1;
+ dbt->phase_seg2 = bt->phase_seg2;
+ dbt->sjw = bt->sjw;
+ dbt->brp = bt->brp;
+
+ rc = usb_control_msg(interface_to_usbdev(intf),
+ usb_sndctrlpipe(interface_to_usbdev(intf), 0),
+ GS_USB_BREQ_BITTIMING,
+ USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ dev->channel,
+ 0,
+ dbt,
+ sizeof(*dbt),
+ 1000);
+ if (rc < 0)
+ dev_warn(netdev->dev.parent, "Couldn't set bittimings %d", rc);
+
+ kfree(dbt);
+
+ return rc;
+}
+
+static int gs_usb_set_mode(struct net_device *netdev, enum can_mode mode)
+{
+ if (mode == CAN_MODE_START) {
+ netif_wake_queue(netdev);
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
+}
+
+static int gs_usb_get_state(const struct net_device *netdev,
+enum can_state *state)
+{
+
+ struct gs_can *dev = netdev_priv(netdev);
+ struct usb_interface *intf = dev->iface;
+ int rc;
+ struct gs_device_state *dstate;
+
+ dev_warn(netdev->dev.parent, "CAN state");
+
+ dstate = kmalloc(sizeof(*dstate), GFP_KERNEL);
+ if (!dstate)
+ return -ENOMEM;
+
+ rc = usb_control_msg(interface_to_usbdev(intf),
+ usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
+ GS_USB_BREQ_BERR,
+ USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ dev->channel,
+ 0,
+ dstate,
+ sizeof(*dstate),
+ 1000);
+
+ if (rc < 0) {
+ dev_warn(netdev->dev.parent, "Couldn't get state %d", rc);
+ kfree(dstate);
+ return rc;
+ }
+
+ switch (dstate->state) {
+ /* RX/TX error count < 96 */
+ case GS_CAN_STATE_ERROR_ACTIVE:
+ *state = CAN_STATE_ERROR_ACTIVE;
+ break;
+ /* RX/TX error count < 128 */
+ case GS_CAN_STATE_ERROR_WARNING:
+ *state = CAN_STATE_ERROR_WARNING;
+ break;
+ /* RX/TX error count < 256 */
+ case GS_CAN_STATE_ERROR_PASSIVE:
+ *state = CAN_STATE_ERROR_PASSIVE;
+ break;
+ /* RX/TX error count >= 256 */
+ case GS_CAN_STATE_BUS_OFF:
+ *state = CAN_STATE_BUS_OFF;
+ break;
+ /* Device is stopped */
+ case GS_CAN_STATE_STOPPED:
+ *state = CAN_STATE_STOPPED;
+ break;
+ /* Device is sleeping */
+ case GS_CAN_STATE_SLEEPING:
+ *state = CAN_STATE_SLEEPING;
+ break;
+ default:
+ kfree(dstate);
+ return -ENOTSUPP;
+ }
+
+ kfree(dstate);
+ return 0;
+}
+
+static int gs_usb_get_berr_counter(const struct net_device *netdev,
+struct can_berr_counter *bec)
+{
+ struct gs_can *dev = netdev_priv(netdev);
+ struct usb_interface *intf = dev->iface;
+ int rc;
+ struct gs_device_state *dstate;
+
+ dstate = kmalloc(sizeof(*dstate), GFP_KERNEL);
+ if (!dstate)
+ return -ENOMEM;
+
+ rc = usb_control_msg(interface_to_usbdev(intf),
+ usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
+ GS_USB_BREQ_BERR,
+ USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ dev->channel,
+ 0,
+ dstate,
+ sizeof(*dstate),
+ 1000);
+ if (rc < 0) {
+ dev_warn(netdev->dev.parent, "Couldn't get error counters %d",
+ rc);
+ kfree(dstate);
+ return rc;
+ }
+
+ bec->txerr = dstate->txerr;
+ bec->rxerr = dstate->rxerr;
+
+ kfree(dstate);
+ return 0;
+}
+
+static void gs_usb_xmit_callback(struct urb *urb)
+{
+ struct gs_tx_context *txc = urb->context;
+ struct gs_can *dev;
+ struct net_device *netdev;
+
+ BUG_ON(!txc);
+
+ dev = txc->dev;
+ BUG_ON(!dev);
+
+ netdev = dev->netdev;
+ BUG_ON(!netdev);
+
+ if (urb->status) {
+ dev_info(netdev->dev.parent, "%d] xmit err %d\n",
+ dev->channel, txc->echo_id);
+ }
+
+ usb_free_coherent(urb->dev,
+ urb->transfer_buffer_length,
+ urb->transfer_buffer,
+ urb->transfer_dma);
+
+ atomic_dec(&dev->active_tx_urbs);
+
+ if (!netif_device_present(netdev))
+ return;
+
+ if (netif_queue_stopped(netdev))
+ netif_wake_queue(netdev);
+}
+
+static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
+struct net_device *netdev)
+{
+ struct gs_can *dev = netdev_priv(netdev);
+ struct net_device_stats *stats = &dev->netdev->stats;
+ struct urb *urb;
+ struct gs_host_frame *hf;
+ struct can_frame *cf;
+ int rc;
+ unsigned int idx;
+ struct gs_tx_context *txc;
+
+ if (dev->can.ctrlmode&CAN_CTRLMODE_LISTENONLY)
+ return NETDEV_TX_BUSY;
+
+ if (can_dropped_invalid_skb(netdev, skb))
+ return NETDEV_TX_OK;
+
+ /* find an empty context to keep track of transmission */
+ txc = gs_alloc_tx_context(dev);
+ if (!txc)
+ return NETDEV_TX_BUSY;
+
+ /* create a URB, and a buffer for it */
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!urb) {
+ gs_free_tx_context(txc);
+ dev_err(netdev->dev.parent, "No memory left for URBs\n");
+ goto nomem;
+ }
+
+ hf = usb_alloc_coherent(dev->udev, sizeof(*hf), GFP_ATOMIC,
+ &urb->transfer_dma);
+ if (!hf) {
+ gs_free_tx_context(txc);
+ dev_err(netdev->dev.parent, "No memory left for USB buffer\n");
+ usb_free_urb(urb);
+ goto nomem;
+ }
+
+ cf = (struct can_frame *)skb->data;
+
+ idx = gs_tx_context_id(txc);
+
+ if (idx >= MAX_TX_URBS) {
+ dev_err(netdev->dev.parent, "Invalid tx context %d\n", idx);
+ usb_free_urb(urb);
+ usb_free_coherent(dev->udev,
+ sizeof(*hf),
+ hf,
+ urb->transfer_dma);
+ goto nomem;
+ }
+
+ hf->echo_id = idx;
+ hf->channel = dev->channel;
+
+ hf->can_id = CONVERT_FLAGS(cf->can_id);
+ hf->can_dlc = cf->can_dlc;
+ memcpy(hf->data, cf->data, 8);
+
+ usb_fill_bulk_urb(urb, dev->udev,
+ usb_sndbulkpipe(dev->udev, GSUSB_ENDPOINT_OUT),
+ hf,
+ sizeof(*hf),
+ gs_usb_xmit_callback,
+ txc);
+
+ urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+ usb_anchor_urb(urb, &dev->tx_submitted);
+
+ can_put_echo_skb(skb, netdev, idx);
+
+ atomic_inc(&dev->active_tx_urbs);
+
+ rc = usb_submit_urb(urb, GFP_ATOMIC);
+ if (unlikely(rc)) { /* usb send failed */
+ dev_err(netdev->dev.parent, "usb_submit failed %d\n", rc);
+
+ can_free_echo_skb(netdev, gs_tx_context_id(txc));
+ gs_free_tx_context(txc);
+
+ usb_unanchor_urb(urb);
+ usb_free_coherent(dev->udev,
+ sizeof(*hf),
+ hf,
+ urb->transfer_dma);
+
+ atomic_dec(&dev->active_tx_urbs);
+
+ if (rc == -ENODEV) {
+ netif_device_detach(netdev);
+ } else {
+ dev_warn(netdev->dev.parent, "Failed tx_urb %d\n", rc);
+
+ stats->tx_dropped++;
+ }
+ } else {
+ netdev->trans_start = jiffies;
+
+ /* Slow down tx path */
+ if (atomic_read(&dev->active_tx_urbs) >= MAX_TX_URBS)
+ netif_stop_queue(netdev);
+ }
+
+ /* let usb core take care of this urb */
+ usb_free_urb(urb);
+
+ return NETDEV_TX_OK;
+
+nomem:
+ dev_kfree_skb(skb);
+ stats->tx_dropped++;
+ return NETDEV_TX_OK;
+}
+
+static int gs_can_open(struct net_device *netdev)
+{
+ struct gs_can *dev = netdev_priv(netdev);
+ struct gs_usb *parent = dev->parent;
+ int rc, i;
+ struct gs_device_mode *dm;
+ u32 ctrlmode;
+
+ /* common open */
+ rc = open_candev(netdev);
+ if (rc)
+ return rc;
+
+ if (atomic_add_return(1, &parent->active_channels) == 1) {
+ dev_info(netdev->dev.parent, "Allocating rx URBs\n");
+ for (i = 0; i < MAX_RX_URBS; i++) {
+ struct urb *urb = NULL;
+ u8 *buf = NULL;
+
+ /* alloc rx urb */
+ urb = usb_alloc_urb(0, GFP_KERNEL);
+ if (!urb) {
+ dev_err(netdev->dev.parent,
+ "No memory left for URBs\n");
+ return -ENOMEM;
+ }
+
+ /* alloc rx buffer */
+ buf = usb_alloc_coherent(dev->udev,
+ BUFFER_SIZE,
+ GFP_KERNEL,
+ &urb->transfer_dma);
+ if (!buf) {
+ dev_err(netdev->dev.parent,
+ "No memory left for USB buffer\n");
+ usb_free_urb(urb);
+ return -ENOMEM;
+ }
+
+
+ /* fill, anchor, and submit rx urb */
+ usb_fill_bulk_urb(urb,
+ dev->udev,
+ usb_rcvbulkpipe(dev->udev,
+ GSUSB_ENDPOINT_IN),
+ buf,
+ BUFFER_SIZE,
+ gs_usb_recieve_bulk_callback,
+ parent
+ );
+ urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
+ usb_anchor_urb(urb, &parent->rx_submitted);
+
+ rc = usb_submit_urb(urb, GFP_KERNEL);
+ if (rc) {
+ if (rc == -ENODEV)
+ netif_device_detach(dev->netdev);
+
+ usb_unanchor_urb(urb);
+ break;
+ }
+
+ /* Drop reference,
+ * USB core will take care of freeing it
+ */
+ usb_free_urb(urb);
+ }
+ }
+
+ dm = kmalloc(sizeof(*dm), GFP_KERNEL);
+ if (!dm)
+ return -ENOMEM;
+
+ /* flags */
+ ctrlmode = dev->can.ctrlmode;
+ dm->flags = 0;
+
+ if (ctrlmode & CAN_CTRLMODE_LOOPBACK)
+ dm->flags |= GS_CAN_MODE_LOOP_BACK;
+
+ else if (ctrlmode & CAN_CTRLMODE_LISTENONLY)
+ dm->flags |= GS_CAN_MODE_LISTEN_ONLY;
+
+
+ /* Controller is not allowed to retry TX
+ * this mode is unavailable on atmels uc3c hardware
+ */
+ if (ctrlmode & CAN_CTRLMODE_ONE_SHOT) {
+ dm->flags |= GS_CAN_MODE_ONE_SHOT;
+ dev_warn(netdev->dev.parent, "GS_USB_ONE_SHOT\n");
+ }
+
+ if (ctrlmode & CAN_CTRLMODE_3_SAMPLES) {
+ dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
+ dev_warn(netdev->dev.parent, "GS_USB_TRIPLE_SAMPLE\n");
+ }
+
+
+ /* finally start device */
+ dm->mode = GS_CAN_MODE_START;
+ rc = usb_control_msg(interface_to_usbdev(dev->iface),
+ usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0),
+ GS_USB_BREQ_MODE,
+ USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ dev->channel,
+ 0,
+ dm,
+ sizeof(*dm),
+ 1000);
+
+ kfree(dm);
+
+ if (rc < 0) {
+ dev_warn(netdev->dev.parent, "Couldn't start device %d\n", rc);
+ return rc;
+ }
+
+ /* check mode... */
+ dm = kmalloc(sizeof(*dm), GFP_KERNEL);
+ if (!dm)
+ return -ENOMEM;
+
+ rc = usb_control_msg(interface_to_usbdev(dev->iface),
+ usb_rcvctrlpipe(interface_to_usbdev(dev->iface), 0),
+ GS_USB_BREQ_MODE,
+ USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ dev->channel,
+ 0,
+ dm,
+ sizeof(*dm),
+ 1000);
+
+ if (rc < 0) {
+ dev_warn(netdev->dev.parent, "Couldn't get device mode %d\n",
+ rc);
+ kfree(dm);
+ return rc;
+ }
+
+ kfree(dm);
+
+ dev->can.state = CAN_STATE_ERROR_ACTIVE;
+
+ netif_start_queue(netdev);
+
+ netdev_info(netdev, "CAN open\n");
+ return 0;
+}
+
+/* think: ip link set canx down */
+static int gs_can_close(struct net_device *netdev)
+{
+ int rc;
+ struct gs_can *dev = netdev_priv(netdev);
+ struct gs_usb *parent = dev->parent;
+
+ netif_stop_queue(netdev);
+
+ /* Stop polling */
+ if (atomic_dec_and_test(&parent->active_channels)) {
+ dev_info(netdev->dev.parent,
+ "Freeing rx usb memory\n");
+
+ usb_kill_anchored_urbs(&parent->rx_submitted);
+ }
+
+ rc = gs_cmd_reset(parent, dev);
+ if (rc < 0)
+ dev_warn(netdev->dev.parent, "Couldn't shutdown device %d", rc);
+
+ close_candev(netdev);
+
+ netdev_info(netdev, "CAN close\n");
+ return 0;
+}
+
+/******************************** USB ********************************/
+
+static const struct net_device_ops gs_usb_netdev_ops = {
+ .ndo_open = gs_can_open,
+ .ndo_stop = gs_can_close,
+ .ndo_start_xmit = gs_can_start_xmit,
+};
+
+static int gs_make_candev(struct gs_can **out, unsigned int channel,
+struct usb_interface *intf)
+{
+ struct gs_can *dev;
+ struct net_device *netdev;
+ int rc;
+ struct gs_device_bt_const *bt_const;
+
+ bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL);
+ if (!bt_const)
+ return -ENOMEM;
+
+ /* fetch bit timing constants */
+ rc = usb_control_msg(interface_to_usbdev(intf),
+ usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
+ GS_USB_BREQ_BT_CONST,
+ USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ channel,
+ 0,
+ bt_const,
+ sizeof(*bt_const),
+ 1000);
+
+ if (rc < 0) {
+ dev_err(&intf->dev,
+ "Couldn't get bit timing const for channel %d\n",
+ rc);
+ kfree(bt_const);
+ return rc;
+ }
+
+ dev_info(&intf->dev, "fclock: %d\n", bt_const->fclk_can);
+
+ /* create netdev */
+ netdev = alloc_candev(sizeof(struct gs_can), MAX_TX_URBS);
+ if (!netdev) {
+ dev_err(&intf->dev, "Couldn't alloc candev\n");
+ kfree(bt_const);
+ return -ENOMEM;
+ }
+
+ dev = netdev_priv(netdev);
+
+ netdev->netdev_ops = &gs_usb_netdev_ops;
+
+ netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */
+
+ /* dev settup */
+ strcpy(dev->bt_const.name, "gs_usb");
+ dev->bt_const.tseg1_min = bt_const->tseg1_min;
+ dev->bt_const.tseg1_max = bt_const->tseg1_max;
+ dev->bt_const.tseg2_min = bt_const->tseg2_min;
+ dev->bt_const.tseg2_max = bt_const->tseg2_max;
+ dev->bt_const.sjw_max = bt_const->sjw_max;
+ dev->bt_const.brp_min = bt_const->brp_min;
+ dev->bt_const.brp_max = bt_const->brp_max;
+ dev->bt_const.brp_inc = bt_const->brp_inc;
+
+ dev->udev = interface_to_usbdev(intf);
+ dev->iface = intf;
+ dev->netdev = netdev;
+ dev->channel = channel;
+
+ init_usb_anchor(&dev->tx_submitted);
+ atomic_set(&dev->active_tx_urbs, 0);
+ spin_lock_init(&dev->tx_ctx_lock);
+ for (rc = 0; rc < MAX_TX_URBS; rc++) {
+ dev->tx_context[rc].dev = dev;
+ dev->tx_context[rc].echo_id = MAX_TX_URBS;
+ }
+
+ /* can settup */
+ dev->can.state = CAN_STATE_STOPPED;
+ dev->can.clock.freq = bt_const->fclk_can;
+ dev->can.bittiming_const = &dev->bt_const;
+ dev->can.do_set_bittiming = gs_usb_set_bittiming;
+ dev->can.do_set_mode = gs_usb_set_mode;
+ dev->can.do_get_state = gs_usb_get_state;
+ dev->can.do_get_berr_counter = gs_usb_get_berr_counter;
+
+ dev->can.ctrlmode_supported = 0;
+
+ if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY)
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY;
+
+ if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK)
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK;
+
+ if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE)
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
+
+ if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT)
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT;
+
+ kfree(bt_const);
+
+ SET_NETDEV_DEV(netdev, &intf->dev);
+
+ rc = register_candev(dev->netdev);
+ if (rc) {
+ free_candev(dev->netdev);
+ dev_err(&intf->dev, "Couldn't register candev\n");
+ return rc;
+ }
+
+ *out = dev;
+ return 0;
+}
+
+static void gs_destroy_candev(struct gs_can *dev)
+{
+ unregister_candev(dev->netdev);
+ free_candev(dev->netdev);
+ usb_kill_anchored_urbs(&dev->tx_submitted);
+}
+
+static int gs_usb_probe(struct usb_interface *intf,
+const struct usb_device_id *id)
+{
+ struct gs_usb *dev;
+ int rc = -ENOMEM;
+ unsigned int icount, i;
+ struct gs_host_config *hconf;
+ struct gs_device_config *dconf;
+
+ hconf = kmalloc(sizeof(*hconf), GFP_KERNEL);
+ if (!hconf)
+ return -ENOMEM;
+
+ hconf->byte_order = 0x0000beef;
+
+
+ /* send host config */
+ rc = usb_control_msg(interface_to_usbdev(intf),
+ usb_sndctrlpipe(interface_to_usbdev(intf), 0),
+ GS_USB_BREQ_HOST_FORMAT,
+ USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ 1,
+ intf->altsetting[0].desc.bInterfaceNumber,
+ hconf,
+ sizeof(*hconf),
+ 1000);
+
+ kfree(hconf);
+
+ if (rc < 0) {
+ dev_err(&intf->dev, "Couldn't send data format: %d\n",
+ rc);
+ return rc;
+ }
+
+
+ dconf = kmalloc(sizeof(*dconf), GFP_KERNEL);
+ if (!dconf)
+ return -ENOMEM;
+
+ /* read device config */
+ rc = usb_control_msg(interface_to_usbdev(intf),
+ usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
+ GS_USB_BREQ_DEVICE_CONFIG,
+ USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
+ 1,
+ intf->altsetting[0].desc.bInterfaceNumber,
+ dconf,
+ sizeof(*dconf),
+ 1000);
+ if (rc < 0) {
+ dev_err(&intf->dev, "Couldn't recieve device config: %d\n",
+ rc);
+ return rc;
+ }
+
+ icount = dconf->icount+1;
+ kfree(dconf);
+
+ dev_info(&intf->dev, "Configuring for %d interfaces\n", icount);
+
+ if (icount > MAX_INTF) {
+ dev_err(&intf->dev,
+ "Driver cannot handle more that %d Can interfaces\n",
+ MAX_INTF);
+ return -EINVAL;
+ }
+
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ init_usb_anchor(&dev->rx_submitted);
+
+ atomic_set(&dev->active_channels, 0);
+
+ usb_set_intfdata(intf, dev);
+
+ for (i = 0; i < icount; i++) {
+ rc = gs_make_candev(&dev->canch[i], i, intf);
+ if (rc) {
+ /* on failure destroy previously created candevs */
+ icount = i;
+ for (i = 0; i < icount; i++) {
+ gs_destroy_candev(dev->canch[i]);
+ dev->canch[icount] = NULL;
+ }
+ return rc;
+ }
+ dev->canch[i]->parent = dev;
+ }
+
+ dev_info(&intf->dev, "Probe\n");
+ return 0;
+}
+
+static void gs_usb_disconnect(struct usb_interface *intf)
+{
+ unsigned i;
+ struct gs_usb *dev = usb_get_intfdata(intf);
+ usb_set_intfdata(intf, NULL);
+
+ if (!dev) {
+ dev_info(&intf->dev, "Disconnect (nodata)\n");
+ return;
+ }
+
+ for (i = 0; i < MAX_INTF; i++) {
+ struct gs_can *can = dev->canch[i];
+
+ if (!can)
+ continue;
+
+ gs_destroy_candev(can);
+ }
+
+ usb_kill_anchored_urbs(&dev->rx_submitted);
+
+ dev_info(&intf->dev, "Disconnect\n");
+}
+
+MODULE_DEVICE_TABLE(usb, gs_usb_table);
+
+static struct usb_device_id gs_usb_table[] = {
+ {USB_DEVICE(USB_GSUSB_1_VENDOR_ID, USB_GSUSB_1_PRODUCT_ID)},
+ {} /* Terminating entry */
+};
+
+static struct usb_driver gs_usb_driver = {
+ .name = "gs_usb",
+ .probe = gs_usb_probe,
+ .disconnect = gs_usb_disconnect,
+ .id_table = gs_usb_table
+};
+
+static int __init gs_usb_init(void)
+{
+ return usb_register(&gs_usb_driver);
+}
+
+static void __exit gs_usb_exit(void)
+{
+ usb_deregister(&gs_usb_driver);
+}
+
+module_init(gs_usb_init);
+module_exit(gs_usb_exit);
+
+MODULE_AUTHOR("Maximilian Schneider <mws@schneidersoft.net>");
+MODULE_DESCRIPTION(
+"Socket CAN device driver for Geschwister Schneider Technologie-, "
+"Entwicklungs- und Vertriebs UG. USB2.0 to CAN interfaces.");
+MODULE_LICENSE("GPL v2");
+
--
1.7.10.4
^ permalink raw reply related [flat|nested] 20+ messages in thread* (unknown),
@ 2013-05-08 6:25 kedari appana
0 siblings, 0 replies; 20+ messages in thread
From: kedari appana @ 2013-05-08 6:25 UTC (permalink / raw)
To: linux-can@vger.kernel.org, Marc Kleine-Budde
Hi,
if i type the below command i am getting the following errors
# ip link show can0
2: can0: <NOARP40000> mtu 16 qdisc noop qlen 10
link/[280]
#cat /proc/interrupts
in this i am not getting entry for my can interrupt handler
#./canconfig can0 bitrate 50000 ctrlmode triple-sampling on
this command was successfull but when i debugging it is showing can0:
bit-timing not yet defined
#If i use ifconfig can0 up
error is can0: bit-timing not yet defined
ifconfig: SIOCSIFFLAGS: Invalid argument
Please help me what is the problem.
regards,
Kedar.
^ permalink raw reply [flat|nested] 20+ messages in thread* (unknown),
@ 2012-12-26 11:41 Kevin Chen
0 siblings, 0 replies; 20+ messages in thread
From: Kevin Chen @ 2012-12-26 11:41 UTC (permalink / raw)
To: killsos.ql
http://david-hoffman.net/wp-content/plugins/akismet/google.html
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2020-06-27 21:58 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-07 12:12 (unknown), kedari appana
2013-05-07 12:28 ` iproute2 and libsocketcan Marc Kleine-Budde
-- strict thread matches above, loose matches on Subject: below --
2020-06-27 21:52 (unknown) helen
2020-05-08 22:58 (unknown) Barbara D Wilkins
2020-03-09 7:34 (unknown) Michael J. Weirsky
2020-03-05 10:46 (unknown) Juanito S. Galang
2020-03-05 0:26 (unknown) Maria Alessandra Filippi
2017-12-01 14:22 (unknown), Rein Appeldoorn
2017-09-01 19:52 (unknown), sunaina
2017-03-02 14:44 (unknown), Casperina Litaay
2016-09-17 8:07 (unknown), makafe david
2016-01-20 10:23 (unknown), Marc Kleine-Budde
2016-01-14 3:01 (unknown), Global Financial Service
2015-12-18 2:32 (unknown), Financial Service
2015-12-08 16:13 (unknown), Loan, Service, <hardiyansyah@mail.binadarma.ac.id>
2015-09-15 20:17 (unknown), Mathieu Erbs
[not found] <1570038211.167595.1414613146892.JavaMail.yahoo@jws10056.mail.ne1.yahoo.com>
[not found] ` <1835234304.171617.1414613165674.JavaMail.yahoo@jws10089.mail.ne1.yahoo.com>
[not found] ` <1938862685.172387.1414613200459.JavaMail.yahoo@jws100180.mail.ne1.yahoo.com>
[not found] ` <705402329.170339.1414613213653.JavaMail.yahoo@jws10087.mail.ne1.yahoo.com>
[not found] ` <760168749.169371.1414613227586.JavaMail.yahoo@jws10082.mail.ne1.yahoo.com>
[not found] ` <1233923671.167957.1414613439879.JavaMail.yahoo@jws10091.mail.ne1.yahoo.com>
[not found] ` <925985882.172122.1414613520734.JavaMail.yahoo@jws100207.mail.ne1.yahoo.com>
[not found] ` <1216694778.172990.1414613570775.JavaMail.yahoo@jws100152.mail.ne1.yahoo.com>
[not found] ` <1213035306.169838.1414613612716.JavaMail.yahoo@jws10097.mail.ne1.yahoo.com>
[not found] ` <2058591563.172973.1414613668636.JavaMail.yahoo@jws10089.mail.ne1.yahoo.com>
[not found] ` <1202030640.175493 .1414613712352.JavaMail.yahoo@jws10036.mail.ne1.yahoo.com>
[not found] ` <1111049042.175610.1414613739099.JavaMail.yahoo@jws100165.mail.ne1.yahoo.com>
[not found] ` <574125160.175950.1414613784216.JavaMail.yahoo@jws100158.mail.ne1.yahoo.com>
[not found] ` <1726966600.175552.1414613846198.JavaMail.yahoo@jws100190.mail.ne1.yahoo.com>
[not found] ` <976499752.219775.1414613888129.JavaMail.yahoo@jws100101.mail.ne1.yahoo.com>
[not found] ` <1400960529.171566.1414613936238.JavaMail.yahoo@jws10059.mail.ne1.yahoo.com>
[not found] ` <1333619289.175040.1414613999304.JavaMail.yahoo@jws100196.mail.ne1.yahoo.com>
[not found] ` <1038759122.176173.1414614054070.JavaMail.yahoo@jws100138.mail.ne1.yahoo.com>
[not found] ` <1109995533.176150.1414614101940.JavaMail.yahoo@jws100140.mail.ne1.yahoo.com>
[not found] ` <809474730.174920.1414614143971.JavaMail.yahoo@jws100154.mail.ne1.yahoo.com>
[not found] ` <1234226428.170349.1414614189490.JavaMail .yahoo@jws10056.mail.ne1.yahoo.com>
[not found] ` <1122464611.177103.1414614228916.JavaMail.yahoo@jws100161.mail.ne1.yahoo.com>
[not found] ` <1350859260.174219.1414614279095.JavaMail.yahoo@jws100176.mail.ne1.yahoo.com>
[not found] ` <1730751880.171557.1414614322033.JavaMail.yahoo@jws10060.mail.ne1.yahoo.com>
[not found] ` <642429550.177328.1414614367628.JavaMail.yahoo@jws100165.mail.ne1.yahoo.com>
[not found] ` <1400780243.20511.1414614418178.JavaMail.yahoo@jws100162.mail.ne1.yahoo.com>
[not found] ` <2025652090.173204.1414614462119.JavaMail.yahoo@jws10087.mail.ne1.yahoo.com>
[not found] ` <859211720.180077.1414614521867.JavaMail.yahoo@jws100147.mail.ne1.yahoo.com>
[not found] ` <258705675.173585.1414614563057.JavaMail.yahoo@jws10078.mail.ne1.yahoo.com>
[not found] ` <1773234186.173687.1414614613736.JavaMail.yahoo@jws10078.mail.ne1.yahoo.com>
[not found] ` <1132079010.173033.1414614645153.JavaMail.yahoo@jws10066.mail.ne1.ya hoo.com>
[not found] ` <1972302405.176488.1414614708676.JavaMail.yahoo@jws100166.mail.ne1.yahoo.com>
[not found] ` <1713123000.176308.1414614771694.JavaMail.yahoo@jws10045.mail.ne1.yahoo.com>
[not found] ` <299800233.173413.1414614817575.JavaMail.yahoo@jws10066.mail.ne1.yahoo.com>
[not found] ` <494469968.179875.1414614903152.JavaMail.yahoo@jws100144.mail.ne1.yahoo.com>
[not found] ` <2136945987.171995.1414614942776.JavaMail.yahoo@jws10091.mail.ne1.yahoo.com>
[not found] ` <257674219.177708.1414615022592.JavaMail.yahoo@jws100181.mail.ne1.yahoo.com>
[not found] ` <716927833.181664.1414615075308.JavaMail.yahoo@jws100145.mail.ne1.yahoo.com>
[not found] ` <874940984.178797.1414615132802.JavaMail.yahoo@jws100157.mail.ne1.yahoo.com>
[not found] ` <1283488887.176736.1414615187657.JavaMail.yahoo@jws100183.mail.ne1.yahoo.com>
[not found] ` <777665713.175887.1414615236293.JavaMail.yahoo@jws10083.mail.ne1.yahoo.com>
[not found] ` <585395776.176325.1 414615298260.JavaMail.yahoo@jws10033.mail.ne1.yahoo.com>
[not found] ` <178352191.221832.1414615355071.JavaMail.yahoo@jws100104.mail.ne1.yahoo.com>
[not found] ` <108454213.176606.1414615522058.JavaMail.yahoo@jws10053.mail.ne1.yahoo.com>
[not found] ` <1617229176.177502.1414615563724.JavaMail.yahoo@jws10030.mail.ne1.yahoo.com>
[not found] ` <324334617.178254.1414615625247.JavaMail.yahoo@jws10089.mail.ne1.yahoo.com>
[not found] ` <567135865.82376.1414615664442.JavaMail.yahoo@jws100136.mail.ne1.yahoo.com>
[not found] ` <764758300.179669.1414615711821.JavaMail.yahoo@jws100107.mail.ne1.yahoo.com>
[not found] ` <1072855470.183388.1414615775798.JavaMail.yahoo@jws100147.mail.ne1.yahoo.com>
[not found] ` <2134283632.173314.1414615831322.JavaMail.yahoo@jws10094.mail.ne1.yahoo.com>
[not found] ` <1454491902.178612.1414615875076.JavaMail.yahoo@jws100209.mail.ne1.yahoo.com>
[not found] ` <1480763910.146593.1414958012342.JavaMail.yahoo@jws10033.mail.ne1.yahoo.com>
2014-11-02 19:54 ` (unknown) MRS GRACE MANDA
2013-10-02 19:45 (unknown), Max S.
2013-05-08 6:25 (unknown), kedari appana
2012-12-26 11:41 (unknown), Kevin Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).